Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

feat(media-server): reject audio and probe ops under memory pressure

Richie McIlroy520b2a3f0027
diff --git a/apps/media-server/src/lib/media-operations.ts b/apps/media-server/src/lib/media-operations.ts
index 53f17fa59..1c9901dd8 100644
--- a/apps/media-server/src/lib/media-operations.ts
+++ b/apps/media-server/src/lib/media-operations.ts
@@ -1,3 +1,4 @@
+import { hasCriticalMemoryPressure } from "./job-manager";
import { terminateAllSubprocesses } from "./subprocess";
export interface MediaOperationHandle {
@@ -30,7 +31,10 @@ export function getActiveAudioOperationCount(): number {
}
export function canAcceptNewAudioOperation(): boolean {
- return getActiveAudioOperationCount() < MAX_CONCURRENT_AUDIO_OPERATIONS;
+ return (
+ !hasCriticalMemoryPressure() &&
+ getActiveAudioOperationCount() < MAX_CONCURRENT_AUDIO_OPERATIONS
+ );
}
export function getActiveProbeOperationCount(): number {
@@ -42,7 +46,10 @@ export function getActiveProbeOperationCount(): number {
}
export function canAcceptNewProbeOperation(): boolean {
- return getActiveProbeOperationCount() < MAX_CONCURRENT_PROBE_OPERATIONS;
+ return (
+ !hasCriticalMemoryPressure() &&
+ getActiveProbeOperationCount() < MAX_CONCURRENT_PROBE_OPERATIONS
+ );
}
export function registerMediaOperation(