Created
March 20, 2013 19:11
-
-
Save cjhanks/5207545 to your computer and use it in GitHub Desktop.
JS loop
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
Slot.prototype.poll = function () { | |
/* This polls infinitely for new work in the queue and if they become | |
* available properly routes the input into execution. | |
* | |
* Note that is very important to be careful to call semantics in this | |
* function to prevent stack overflow. | |
*/ | |
var self = this; | |
self['swf'].pollForActivityTask(self['aws_opts'], function (err, res) { | |
if (err) | |
self.emit('exception', err); | |
if (null == res || !res.taskToken) | |
self.poll(); | |
else | |
self.exec(res, function () { self.poll(); }); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment