MCPcopy Create free account
hub / github.com/PrairieLearn/PrairieLearn / drainQueue

Function drainQueue

public/javascripts/socket.io.js:593–615  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

591 }
592
593 function drainQueue() {
594 if (draining) {
595 return;
596 }
597 var timeout = runTimeout(cleanUpNextTick);
598 draining = true;
599
600 var len = queue.length;
601 while(len) {
602 currentQueue = queue;
603 queue = [];
604 while (++queueIndex < len) {
605 if (currentQueue) {
606 currentQueue[queueIndex].run();
607 }
608 }
609 queueIndex = -1;
610 len = queue.length;
611 }
612 currentQueue = null;
613 draining = false;
614 runClearTimeout(timeout);
615 }
616
617 process.nextTick = function (fun) {
618 var args = new Array(arguments.length - 1);

Callers 1

cleanUpNextTickFunction · 0.70

Calls 3

runTimeoutFunction · 0.85
runClearTimeoutFunction · 0.85
runMethod · 0.80

Tested by

no test coverage detected