diff options
author | Holden Rohrer <hr@hrhr.dev> | 2020-01-17 00:35:37 -0500 |
---|---|---|
committer | Holden Rohrer <hr@hrhr.dev> | 2020-01-17 00:35:37 -0500 |
commit | 870d834c5d20d67820d68d94e345ed7e6a66af9e (patch) | |
tree | 17fbb98ad999d2e86a5ab474c62646f8b7c518ca | |
parent | f71719631dd793f39e6c629314fd81a4c06c19d2 (diff) |
removed extraneous writes var and added comments
-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); } |