diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/schedule.js | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/tools/schedule.js b/tools/schedule.js index 02dc883..7778ed8 100644 --- a/tools/schedule.js +++ b/tools/schedule.js @@ -14,19 +14,16 @@ function Job(data, prio=0, wt=1){ // Mutable Properties this.wacc = 0; // mutable property: Queue will change this to keep track between dequeues of how much "left over" push real estate this should have. - this.start; // The write # this job was introduced on. Also for Queue use. } function Queue(maxExport, call, delay){ // Every delay ms, Queue executes `call(maxExport # of objs in queue)` let jobs = {}; // Links priorities to unordered arrays of jobs let prios = []; // Array of priorities (keys of jobs), sorted. - let open = false; - let disab = true; - let writes = 0; + let open = true; // Is dequeue() allowed to be called (i.e., has the timeout expired?) + let disab = true; // Is the queue disabled? this.enqueue = function(job){ - job.start = writes; let prio = job.prio; if (!jobs[prio]) jobs[prio] = []; jobs[prio].splice(0, Math.abs(bs(jobs[prio], job, (el, ne) => el.maxr - ne.maxr)), job); @@ -59,7 +56,6 @@ function Queue(maxExport, call, delay){ data.push(...getNumOrAll(prios[prios.length-1]), maxExport-data.length); } - writes++; call(data); setTimeout(dequeue, delayms); } |