mirror of https://github.com/OpenVidu/openvidu.git
openvidu-server: more wait time when waiting for files if docker env
parent
80867eb7e7
commit
2e5797e348
|
@ -246,7 +246,7 @@ public class ComposedQuickStartRecordingService extends ComposedRecordingService
|
||||||
|
|
||||||
private void waitForComposedQuickStartFiles(Recording recording) throws Exception {
|
private void waitForComposedQuickStartFiles(Recording recording) throws Exception {
|
||||||
|
|
||||||
final int SECONDS_MAX_WAIT = 30;
|
final int SECONDS_MAX_WAIT = fileManager.maxSecondsWaitForFile();
|
||||||
final String PATH = this.openviduConfig.getOpenViduRecordingPath() + recording.getId() + "/";
|
final String PATH = this.openviduConfig.getOpenViduRecordingPath() + recording.getId() + "/";
|
||||||
|
|
||||||
// Waiting for the files generated at the end of the stopping process: the
|
// Waiting for the files generated at the end of the stopping process: the
|
||||||
|
@ -264,8 +264,7 @@ public class ComposedQuickStartRecordingService extends ComposedRecordingService
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
try {
|
try {
|
||||||
fileManager.waitForFileToExistAndNotEmpty(recording.getRecordingProperties().mediaNode(), file,
|
fileManager.waitForFileToExistAndNotEmpty(recording.getRecordingProperties().mediaNode(), file);
|
||||||
SECONDS_MAX_WAIT);
|
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
recording.setStatus(io.openvidu.java.client.Recording.Status.failed);
|
recording.setStatus(io.openvidu.java.client.Recording.Status.failed);
|
||||||
|
@ -282,7 +281,7 @@ public class ComposedQuickStartRecordingService extends ComposedRecordingService
|
||||||
if (!latch.await(SECONDS_MAX_WAIT, TimeUnit.SECONDS)) {
|
if (!latch.await(SECONDS_MAX_WAIT, TimeUnit.SECONDS)) {
|
||||||
recording.setStatus(io.openvidu.java.client.Recording.Status.failed);
|
recording.setStatus(io.openvidu.java.client.Recording.Status.failed);
|
||||||
String msg = "The wait for files of COMPOSED_QUICK_START recording " + recording.getId()
|
String msg = "The wait for files of COMPOSED_QUICK_START recording " + recording.getId()
|
||||||
+ " didn't complete in " + SECONDS_MAX_WAIT + " seconds";
|
+ " didn't complete in " + fileManager.maxSecondsWaitForFile() + " seconds";
|
||||||
log.error(msg);
|
log.error(msg);
|
||||||
throw new Exception(msg);
|
throw new Exception(msg);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -433,9 +433,7 @@ public class ComposedRecordingService extends RecordingService {
|
||||||
protected void waitForVideoFileNotEmpty(Recording recording) throws Exception {
|
protected void waitForVideoFileNotEmpty(Recording recording) throws Exception {
|
||||||
final String VIDEO_FILE = this.openviduConfig.getOpenViduRecordingPath() + recording.getId() + "/"
|
final String VIDEO_FILE = this.openviduConfig.getOpenViduRecordingPath() + recording.getId() + "/"
|
||||||
+ recording.getName() + RecordingService.COMPOSED_RECORDING_EXTENSION;
|
+ recording.getName() + RecordingService.COMPOSED_RECORDING_EXTENSION;
|
||||||
int SECONDS_MAX_WAIT = 20;
|
this.fileManager.waitForFileToExistAndNotEmpty(recording.getRecordingProperties().mediaNode(), VIDEO_FILE);
|
||||||
this.fileManager.waitForFileToExistAndNotEmpty(recording.getRecordingProperties().mediaNode(), VIDEO_FILE,
|
|
||||||
SECONDS_MAX_WAIT);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void failRecordingCompletion(Recording recording, String containerId, boolean removeContainer,
|
protected void failRecordingCompletion(Recording recording, String containerId, boolean removeContainer,
|
||||||
|
|
|
@ -121,7 +121,8 @@ public abstract class CustomFileManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract void waitForFileToExistAndNotEmpty(String mediaNodeId, String absolutePathToFile,
|
public abstract void waitForFileToExistAndNotEmpty(String mediaNodeId, String absolutePathToFile) throws Exception;
|
||||||
int maxSecondsWait) throws Exception;
|
|
||||||
|
public abstract int maxSecondsWaitForFile();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,12 +5,12 @@ import java.io.File;
|
||||||
public class LocalCustomFileManager extends CustomFileManager {
|
public class LocalCustomFileManager extends CustomFileManager {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void waitForFileToExistAndNotEmpty(String mediaNodeId, String absolutePathToFile, int maxSeconsWait)
|
public void waitForFileToExistAndNotEmpty(String mediaNodeId, String absolutePathToFile) throws Exception {
|
||||||
throws Exception {
|
|
||||||
|
|
||||||
// Check 10 times per seconds
|
// Check 10 times per seconds
|
||||||
|
int MAX_SECONDS_WAIT = this.maxSecondsWaitForFile();
|
||||||
int MILLISECONDS_INTERVAL_WAIT = 100;
|
int MILLISECONDS_INTERVAL_WAIT = 100;
|
||||||
int LIMIT = maxSeconsWait * 1000 / MILLISECONDS_INTERVAL_WAIT;
|
int LIMIT = MAX_SECONDS_WAIT * 1000 / MILLISECONDS_INTERVAL_WAIT;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
boolean arePresent = fileExistsAndHasBytes(absolutePathToFile);
|
boolean arePresent = fileExistsAndHasBytes(absolutePathToFile);
|
||||||
|
@ -25,7 +25,7 @@ public class LocalCustomFileManager extends CustomFileManager {
|
||||||
}
|
}
|
||||||
if (!arePresent) {
|
if (!arePresent) {
|
||||||
throw new Exception("File " + absolutePathToFile + " does not exist and hasn't been created in "
|
throw new Exception("File " + absolutePathToFile + " does not exist and hasn't been created in "
|
||||||
+ maxSeconsWait + " seconds");
|
+ MAX_SECONDS_WAIT + " seconds");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -34,4 +34,8 @@ public class LocalCustomFileManager extends CustomFileManager {
|
||||||
return (f.exists() && f.isFile() && f.length() > 0);
|
return (f.exists() && f.isFile() && f.length() > 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int maxSecondsWaitForFile() {
|
||||||
|
return 30;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue