Last active
January 13, 2018 18:49
Code that manages queues for River5, for review. See the blog post linked to in the first comment.
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
function readRiverFile (relpath, callback) { | |
var f = config.dataFolder + relpath; | |
if (riverQueues [f] === undefined) { | |
riverQueues [f] = [callback]; | |
fs.readFile (f, function (err, data) { | |
if (err) { | |
console.log ("readRiverFile: err.message == " + err.message); | |
} | |
else { | |
var theQueue = riverQueues [f]; | |
delete riverQueues [f]; | |
for (var i = 0; i < theQueue.length; i++) { | |
theQueue [i] (data); | |
} | |
} | |
}); | |
} | |
else { | |
riverQueues [f].push (callback); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Here's the blog post with the background --
http://scripting.com/2018/01/13/183433.html
Dave