mirror of
https://github.com/ksyasuda/SubMiner.git
synced 2026-08-15 13:55:51 -07:00
feat(core): add Electron runtime, services, and app composition
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import type { QueuedWrite } from './types';
|
||||
|
||||
export function enqueueWrite(
|
||||
queue: QueuedWrite[],
|
||||
write: QueuedWrite,
|
||||
queueCap: number,
|
||||
): {
|
||||
dropped: number;
|
||||
queueLength: number;
|
||||
} {
|
||||
let dropped = 0;
|
||||
if (queue.length >= queueCap) {
|
||||
const overflow = queue.length - queueCap + 1;
|
||||
queue.splice(0, overflow);
|
||||
dropped = overflow;
|
||||
}
|
||||
queue.push(write);
|
||||
return { dropped, queueLength: queue.length };
|
||||
}
|
||||
Reference in New Issue
Block a user