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

Function _next

public/javascripts/async.js:892–913  ·  view source on GitHub ↗
(q, tasks)

Source from the content-addressed store, hash-verified

890 async.setImmediate(q.process);
891 }
892 function _next(q, tasks) {
893 return function(){
894 workers -= 1;
895
896 var removed = false;
897 var args = arguments;
898 _arrayEach(tasks, function (task) {
899 _arrayEach(workersList, function (worker, index) {
900 if (worker === task && !removed) {
901 workersList.splice(index, 1);
902 removed = true;
903 }
904 });
905
906 task.callback.apply(task, args);
907 });
908 if (q.tasks.length + workers === 0) {
909 q.drain();
910 }
911 q.process();
912 };
913 }
914
915 var workers = 0;
916 var workersList = [];

Callers 1

_queueFunction · 0.85

Calls 1

_arrayEachFunction · 0.85

Tested by

no test coverage detected