MCPcopy
hub / github.com/mongodb/node-mongodb-native / waiting

Method waiting

test/tools/mongodb-mock/src/server.js:191–203  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

189 const self = this;
190 return new Promise((resolve, reject) => {
191 const waiting = () => {
192 if (self.state === 'destroyed') {
193 return reject(new Error('mock server is in destroyed state'));
194 }
195
196 // If we have a message return it
197 if (self.messages.length > 0) {
198 const message = self.messages.shift();
199 return resolve(message);
200 }
201
202 setTimeout(waiting, 10);
203 };
204
205 waiting();
206 });

Callers

nothing calls this directly

Calls 2

resolveFunction · 0.50
shiftMethod · 0.45

Tested by

no test coverage detected