-
-
Save bjouhier/7803022 to your computer and use it in GitHub Desktop.
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
//fibers | |
function markComplete(postedItems, completionCallback) { | |
var errors = []; | |
var getItemToUpdate = function(item) { | |
var fiber = Fiber.current; | |
process.nextTick(function() { | |
client.queryEntity('tasks', 'partition1', item, function(err, task) { | |
fiber.run(task); | |
}); | |
}); | |
return Fiber.yield(); | |
}; | |
Fiber(function() { | |
postedItems.forEach(function(item) { | |
task = getItemToUpdate(item); | |
console.log(task); | |
}); | |
completionCallback(undefined); | |
}).run(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Aaah, i saw I could pass to run but didn't realize I can return the yield and it would flow through. OK on the try/catch.
Thanks!
Glenn