Skip to content

Commit

Permalink
Remove pipeline max active contexts checkg
Browse files Browse the repository at this point in the history
  • Loading branch information
serivesmejia committed Sep 27, 2024
1 parent f0d877c commit 72fa9fd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 41 deletions.
42 changes: 5 additions & 37 deletions EOCV-Sim/src/main/java/com/github/serivesmejia/eocvsim/EOCVSim.kt
Original file line number Diff line number Diff line change
Expand Up @@ -388,43 +388,11 @@ class EOCVSim(val params: Parameters = Parameters()) {
inputSourceManager.update(pipelineManager.paused)
tunerManager.update()

try {
pipelineManager.update(
if (inputSourceManager.lastMatFromSource != null && !inputSourceManager.lastMatFromSource.empty()) {
inputSourceManager.lastMatFromSource
} else null
)
} catch (ex: MaxActiveContextsException) { //handles when a lot of pipelines are stuck in the background
visualizer.asyncPleaseWaitDialog(
"There are many pipelines stuck in processFrame running in the background",
"To avoid further issues, EOCV-Sim will exit now.",
"Ok",
Dimension(450, 150),
true,
true
).onCancel {
destroy(DestroyReason.CRASH) //destroy eocv sim when pressing "exit"
}

//print exception
logger.error(
"Please note that the following exception is likely to be caused by one or more of the user pipelines",
ex
)

//block the current thread until the user closes the dialog
try {
//using sleep for avoiding burning cpu cycles
Thread.sleep(Long.MAX_VALUE)
} catch (ignored: InterruptedException) {
//reinterrupt once user closes the dialog
Thread.currentThread().interrupt()
}

break //bye bye
} catch (ex: InterruptedException) {
break // bye bye
}
pipelineManager.update(
if (inputSourceManager.lastMatFromSource != null && !inputSourceManager.lastMatFromSource.empty()) {
inputSourceManager.lastMatFromSource
} else null
)

//limit FPG
fpsLimiter.maxFPS = config.pipelineMaxFps.fps.toDouble()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -275,10 +275,6 @@ class PipelineManager(
}
}

if(activePipelineContexts.size > MAX_ALLOWED_ACTIVE_PIPELINE_CONTEXTS) {
throw MaxActiveContextsException("Current amount of active pipeline coroutine contexts (${activePipelineContexts.size}) is more than the maximum allowed. This generally means that there are multiple pipelines stuck in processFrame() running in the background, check for any lengthy operations in your pipelines.")
}

if(telemetry is TelemetryImpl) {
if (compiledPipelineManager.isBuildRunning) {
telemetry.infoItem.caption = "[>]"
Expand Down

0 comments on commit 72fa9fd

Please sign in to comment.