sync-buildbot.js doesn't mark disappeared builds as failed
[WebKit-https.git] / Websites / perf.webkit.org / tools / js / buildbot-triggerable.js
index 6287ce6..62602c9 100644 (file)
@@ -80,6 +80,7 @@ class BuildbotTriggerable {
     _pullBuildbotOnAllSyncers(buildReqeustsByGroup)
     {
         let updates = {};
+        let associatedRequests = new Set;
         let self = this;
         return Promise.all(this._syncers.map(function (syncer) {
             self._logger.log(`Fetching builds on ${syncer.builderName()}`);
@@ -88,6 +89,7 @@ class BuildbotTriggerable {
                     let request = BuildRequest.findById(entry.buildRequestId());
                     if (!request)
                         continue;
+                    associatedRequests.add(request);
 
                     let info = buildReqeustsByGroup.get(request.testGroupId());
                     assert(!info.syncer || info.syncer == syncer);
@@ -104,7 +106,14 @@ class BuildbotTriggerable {
                     }
                 }
             });
-        })).then(function () { return updates; });
+        })).then(function () {
+            for (let request of BuildRequest.all()) {
+                if (request.hasStarted() && !request.hasFinished() && !associatedRequests.has(request)) {
+                    assert(!(request.id() in updates));
+                    updates[request.id()] = {status: 'failedIfNotCompleted'};
+                }
+            }
+        }).then(function () { return updates; });
     }
 
     _scheduleNextRequestInGroupIfSlaveIsAvailable(groupInfo, pendingUpdates)