@andersbakken/fisk 3.5.1 → 3.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -564,22 +564,7 @@ let jobQueue = [];
564
564
 
565
565
  server.on("headers", (headers, req) => {
566
566
  // console.log("request is", req.headers);
567
- let wait = false;
568
- if (objectCache && objectCache.state(req.headers["x-fisk-sha1"]) == "exists") {
569
- wait = true;
570
- } else if (jobQueue.length >= client.slots) {
571
- const priority = parseInt(req.headers["x-fisk-sha1"]) || 0;
572
- let idx = jobQueue.length - 1;
573
- while (idx >= client.slots) {
574
- let job = jobQueue[idx].job;
575
- if (job.priority >= priority) {
576
- break;
577
- }
578
- --idx;
579
- }
580
-
581
- wait = idx >= client.slots;
582
- }
567
+ let wait = (jobQueue.length >= client.slots || (objectCache && objectCache.state(req.headers["x-fisk-sha1"]) == "exists"));
583
568
  headers.push(`x-fisk-wait: ${wait}`);
584
569
  });
585
570
 
@@ -660,7 +645,7 @@ server.on("job", job => {
660
645
  let uploadDuration;
661
646
 
662
647
  // console.log("sending to server");
663
- const j = {
648
+ var j = {
664
649
  id: job.id,
665
650
  job: job,
666
651
  op: undefined,
@@ -855,17 +840,7 @@ server.on("job", job => {
855
840
  }
856
841
  });
857
842
 
858
- let idx = jobQueue.length;
859
- while (idx > 0) {
860
- const jobJob = jobQueue[idx - 1].job;
861
- if (jobJob.priority >= job.priority) {
862
- // console.log("Stopping at idx", idx, "Because of", job.priority, jobJob.priority, client.slots, jobJob.length);
863
- break;
864
- }
865
- --idx;
866
- }
867
- jobQueue.splice(idx, 0, j);
868
-
843
+ jobQueue.push(j);
869
844
  if (jobQueue.length <= client.slots) {
870
845
  // console.log(`starting j ${j.id} because ${jobQueue.length} ${client.slots}`);
871
846
  j.start();
package/builder/server.js CHANGED
@@ -123,7 +123,6 @@ class Server extends EventEmitter {
123
123
  hostname: req.headers["x-fisk-client-hostname"],
124
124
  user: req.headers["x-fisk-user"],
125
125
  sourceFile: req.headers["x-fisk-sourcefile"],
126
- priority: parseInt(req.headers["x-fisk-priority"]) || 0,
127
126
  sha1: req.headers["x-fisk-sha1"],
128
127
  id: parseInt(req.headers["x-fisk-job-id"]),
129
128
  builderIp: req.headers["x-fisk-builder-ip"] });