MCPcopy Create free account
hub / github.com/firebase/firebase-tools / start

Method start

src/emulator/workQueue.ts:65–96  ·  view source on GitHub ↗

* Begin processing work from the queue.

()

Source from the content-addressed store, hash-verified

63 * Begin processing work from the queue.
64 */
65 async start() {
66 if (!this.stopped) {
67 return;
68 }
69
70 this.stopped = false;
71 while (!this.stopped) {
72 // If the queue is empty, wait until something is added.
73 if (!this.queue.length) {
74 await new Promise<void>((res) => {
75 this.notifyQueue = res;
76 });
77 }
78
79 // If we have too many jobs out, wait until something finishes.
80 if (this.running.length >= this.maxParallelWork) {
81 this.logger.logLabeled(
82 "DEBUG",
83 "work-queue",
84 `waiting for work to finish (running=${this.running})`,
85 );
86 await new Promise<void>((res) => {
87 this.notifyWorkFinish = res;
88 });
89 }
90
91 const workPromise = this.runNext();
92 if (this.mode === FunctionsExecutionMode.SEQUENTIAL) {
93 await workPromise;
94 }
95 }
96 }
97
98 /**
99 * Stop processing work from the queue.

Callers

nothing calls this directly

Calls 2

runNextMethod · 0.95
logLabeledMethod · 0.80

Tested by

no test coverage detected