forked from j62/ctbrec
1
0
Fork 0

(Logging) some tracing

This commit is contained in:
reusedname 2025-02-15 15:10:17 +05:00
parent 6f9024838c
commit 8ca70a510c
2 changed files with 9 additions and 3 deletions

View File

@ -37,6 +37,7 @@ import static ctbrec.SubsequentAction.*;
import static ctbrec.event.Event.Type.MODEL_ONLINE;
import static java.lang.Thread.MAX_PRIORITY;
import static java.lang.Thread.MIN_PRIORITY;
import static java.util.concurrent.TimeUnit.MILLISECONDS;
import static java.util.concurrent.TimeUnit.SECONDS;
@Slf4j
@ -62,7 +63,7 @@ public class SimplifiedLocalRecorder implements Recorder {
private final ThreadPoolExecutor postProcessing;
private final Thread maintenanceThread;
private long lastSpaceCheck;
public SimplifiedLocalRecorder(Config config, List<Site> sites) throws IOException {
this.config = config;
@ -260,6 +261,7 @@ public class SimplifiedLocalRecorder implements Recorder {
} catch (RejectedExecutionException e) {
log.error("Could not start post-processing for {} {}:{}. Execution rejected by thread pool", recording, recording.getModel().getSite().getName(), recording.getModel().getDisplayName());
}
log.trace("submitPostProcessingJob(): {}", postProcessing);
}
private void runPostProcessing(Recording recording) throws IOException, InterruptedException {
@ -921,7 +923,7 @@ public class SimplifiedLocalRecorder implements Recorder {
log.info("Resuming recorder");
running = true;
}
@Override
public boolean isForcePriority(Model model) {
return findModel(model).map(Model::isForcePriority).orElse(false);

View File

@ -56,7 +56,7 @@ public class MergedFfmpegHlsDownload extends AbstractHlsDownload {
startFfmpegProcess(targetFile);
if (ffmpegProcess == null) {
throw new ProcessExitedUncleanException("Couldn't spawn FFmpeg");
}
}
}
@Override
@ -81,6 +81,7 @@ public class MergedFfmpegHlsDownload extends AbstractHlsDownload {
downloadExecutor.submit(() -> {
ffmpegStreamLock.lock();
try {
LOG.trace("Starting streaming segments to file {}", targetFile);
while (!queue.isEmpty() && !Thread.currentThread().isInterrupted()) {
try {
Future<SegmentDownload> future = queue.peek();
@ -95,11 +96,13 @@ public class MergedFfmpegHlsDownload extends AbstractHlsDownload {
break;
}
} catch (InterruptedException e) {
LOG.trace("Segment download interrupted for model {}", model, e);
Thread.currentThread().interrupt();
} catch (Exception e) {
LOG.error("Segment download failed for model {}", model, e);
}
}
LOG.trace("Finishing streaming segments to file {}", targetFile);
} finally {
ffmpegStreamLock.unlock();
}
@ -146,6 +149,7 @@ public class MergedFfmpegHlsDownload extends AbstractHlsDownload {
@Override
protected void execute(SegmentDownload segmentDownload) {
queue.add(segmentDownloadService.submit(segmentDownload));
LOG.trace("Enqueuing segment for file {}", targetFile);
}
@Override