Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
OLAT CI-CD Testing Project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Requirements
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Deploy
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Lars Oliver Dam
OLAT CI-CD Testing Project
Commits
488d7c44
Commit
488d7c44
authored
5 years ago
by
srosse
Browse files
Options
Downloads
Patches
Plain Diff
OO-4276: catch more case to break the transcoding queue
parent
73dcbb0b
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/main/java/org/olat/modules/video/manager/VideoTranscodingJob.java
+14
-5
14 additions, 5 deletions
...a/org/olat/modules/video/manager/VideoTranscodingJob.java
with
14 additions
and
5 deletions
src/main/java/org/olat/modules/video/manager/VideoTranscodingJob.java
+
14
−
5
View file @
488d7c44
...
@@ -54,10 +54,6 @@ import org.quartz.JobExecutionException;
...
@@ -54,10 +54,6 @@ import org.quartz.JobExecutionException;
public
class
VideoTranscodingJob
extends
JobWithDB
{
public
class
VideoTranscodingJob
extends
JobWithDB
{
private
ArrayList
<
String
>
resolutionsWithProfile
=
new
ArrayList
<>(
Arrays
.
asList
(
"1080"
,
"720"
,
"480"
));
private
ArrayList
<
String
>
resolutionsWithProfile
=
new
ArrayList
<>(
Arrays
.
asList
(
"1080"
,
"720"
,
"480"
));
/**
*
* @see org.olat.core.commons.services.scheduler.JobWithDB#executeWithDB(org.quartz.JobExecutionContext)
*/
@Override
@Override
public
void
executeWithDB
(
JobExecutionContext
context
)
throws
JobExecutionException
{
public
void
executeWithDB
(
JobExecutionContext
context
)
throws
JobExecutionException
{
// uses StatefulJob interface to prevent concurrent job execution
// uses StatefulJob interface to prevent concurrent job execution
...
@@ -80,11 +76,24 @@ public class VideoTranscodingJob extends JobWithDB {
...
@@ -80,11 +76,24 @@ public class VideoTranscodingJob extends JobWithDB {
// Find first one to work with
// Find first one to work with
boolean
allOk
=
true
;
boolean
allOk
=
true
;
for
(
VideoTranscoding
videoTranscoding
=
getNextVideo
();
videoTranscoding
!=
null
;
videoTranscoding
=
getNextVideo
())
{
for
(
VideoTranscoding
videoTranscoding
=
getNextVideo
();
videoTranscoding
!=
null
;
videoTranscoding
=
getNextVideo
())
{
if
(
cancelTranscoding
())
{
break
;
}
allOk
&=
forkTranscodingProcess
(
videoTranscoding
);
allOk
&=
forkTranscodingProcess
(
videoTranscoding
);
}
}
return
allOk
;
return
allOk
;
}
}
private
boolean
cancelTranscoding
()
{
try
{
VideoModule
videoModule
=
CoreSpringFactory
.
getImpl
(
VideoModule
.
class
);
return
(!
videoModule
.
isTranscodingLocal
()
||
!
videoModule
.
isTranscodingEnabled
());
}
catch
(
Exception
e
)
{
log
.
error
(
""
,
e
);
return
true
;
}
}
private
VideoTranscoding
getNextVideo
()
{
private
VideoTranscoding
getNextVideo
()
{
VideoManager
videoManager
=
CoreSpringFactory
.
getImpl
(
VideoManager
.
class
);
VideoManager
videoManager
=
CoreSpringFactory
.
getImpl
(
VideoManager
.
class
);
List
<
VideoTranscoding
>
videoTranscodings
=
videoManager
.
getVideoTranscodingsPendingAndInProgress
();
List
<
VideoTranscoding
>
videoTranscodings
=
videoManager
.
getVideoTranscodingsPendingAndInProgress
();
...
@@ -170,7 +179,7 @@ public class VideoTranscodingJob extends JobWithDB {
...
@@ -170,7 +179,7 @@ public class VideoTranscodingJob extends JobWithDB {
ProcessBuilder
builder
=
new
ProcessBuilder
(
cmd
);
ProcessBuilder
builder
=
new
ProcessBuilder
(
cmd
);
process
=
builder
.
start
();
process
=
builder
.
start
();
return
updateVideoTranscodingFromProcessOutput
(
process
,
videoTranscoding
,
transcodedFile
);
return
updateVideoTranscodingFromProcessOutput
(
process
,
videoTranscoding
,
transcodedFile
);
}
catch
(
IO
Exception
e
)
{
}
catch
(
Exception
e
)
{
log
.
error
(
"Could not spawn convert sub process"
,
e
);
log
.
error
(
"Could not spawn convert sub process"
,
e
);
return
false
;
return
false
;
}
finally
{
}
finally
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment