Skip to content

Commit

Permalink
Verify that the Sauce readyFile has changed
Browse files Browse the repository at this point in the history
The readyFile watcher may emit multiple events. Dig Dug should only pay
attention to the first one in which the readyFile was modified.
  • Loading branch information
jason0x43 committed Mar 28, 2015
1 parent 74850be commit 8ba5dae
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion SauceLabsTunnel.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,12 @@ SauceLabsTunnel.prototype = util.mixin(Object.create(_super), /** @lends module:

// Polling API is used because we are only watching for one file, so efficiency is not a big deal, and the
// `fs.watch` API has extra restrictions which are best avoided
fs.watchFile(readyFile, { persistent: false, interval: 1007 }, function () {
fs.watchFile(readyFile, { persistent: false, interval: 1007 }, function (current, previous) {
if (Number(current.mtime) === Number(previous.mtime)) {
// readyFile hasn't been modified, so ignore the event
return;
}

fs.unwatchFile(readyFile);

// We have to watch for errors until the tunnel has started successfully at which point we only want to
Expand Down

0 comments on commit 8ba5dae

Please sign in to comment.