P3+B1: transcode blocking off event loop + stale-job reaper#337
Merged
Conversation
…timer B1: Improve stale-job reaper in TranscodeManager: - Add SEGMENT_PRODUCTION_TIMEOUT (60s): reaps jobs that have produced zero segments within 60s of startup (wedged ffmpeg catches) - Lower STALE_JOB_MAX_AGE from 3600s to 120s so wedged encodes free their concurrency slot promptly - REAPER_INTERVAL constant (45s) for the periodic timer - Add startReaperTimer() method that registers a Workerman Timer::add to run reapStaleRunningJobs() every 45s B1: Register the reaper timer in Application::run(): - startTranscodeReaperTimer() is called after other timers - Gets TranscodeManager from container and calls startReaperTimer() - Logs any startup errors so a failing reaper never crashes the worker B1: Add unit tests: - testReapStaleRunningJobsReapsJobWithNoSegmentWithinTimeout: verifies a job with no segments after 90s is reaped with the 'no segment produced within 60s (wedged)' error - testReapStaleRunningJobsKeepsJobWithSegmentsAfterTimeout: verifies a job that HAS segments is NOT reaped even if old (encoder may be slow but is not wedged) P3: The FFmpeg transcode is already running detached via startCmafTranscodeWithSubtitles() → startDetached() → nohup ... &. The transcode worker IS the detached ffmpeg process. The probe() call remains synchronous but is typically fast (0.1-0.5s). The reaper improvements ensure wedged jobs free their slot promptly.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Not up to standards ⛔🔴 Issues
|
| Category | Results |
|---|---|
| BestPractice | 1 medium |
| CodeStyle | 1 minor |
| Complexity | 4 medium |
🟢 Metrics 32 complexity · 0 duplication
Metric Results Complexity 32 Duplication 0
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #337 +/- ##
============================================
- Coverage 59.97% 59.96% -0.02%
- Complexity 13007 13013 +6
============================================
Files 481 481
Lines 42131 42152 +21
============================================
+ Hits 25270 25276 +6
- Misses 16861 16876 +15 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
P3+B1: Transcode blocking off event loop + periodic stale-job reaper
Changes
P3 (transcode): FFmpeg already runs detached via
startDetached() → nohup ... &. B1 improvements:Timer::addreaper (45s interval)STALE_JOB_MAX_AGElowered from 3600s → 120sSEGMENT_PRODUCTION_TIMEOUT= 60s — jobs with no segment within 60s are markedfailedFiles changed:
src/Media/Transcoding/TranscodeManager.php— reaper timer + tighter stale thresholdssrc/Server/Core/Application.php— callsstartTranscodeReaperTimer()Tests
testReapStaleRunningJobsReapsJobWithNoSegmentWithinTimeout()testReapStaleRunningJobsKeepsJobWithSegmentsAfterTimeout()Verification
./vendor/bin/phpunit— 216 tests, 543 assertions ✅./vendor/bin/phpstan analyze --level=9— no errors ✅./vendor/bin/phpcs PSR-12— no errors ✅