forked from guard/listen
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Alter "wait for changes" algorithm to wait for incoming changes to ac…
…cumulate before calling block. Fixes guard#202 The new algorithm is (pseudocode): loop begin sleep options[:wait_for_delay] # wait for changes to accumulate new_changes = _pop_changes changes += new_changes end until new_changes.empty? unless changes.empty? block.call(changes) end end Note that the "sleep" happens both before and after any callback, so the value of wait_for_delay is effectively doubled. This also means that if the filesystem is constantly changing, the callback will never happen... maybe we should check for this and bail out after, say, 10 seconds even if new changes keep on coming.
- Loading branch information
Showing
4 changed files
with
60 additions
and
19 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters