[API] timeout for .join(), .synchronize(), .promise().cancel(), and .subscription().stop().resume().stopUntilNextIssue()

2 views
Skip to first unread message

AJ ONeal

unread,
Jul 22, 2010, 3:30:53 AM7/22/10
to futures-j...@googlegroups.com
ACCEPTED:

I updated Futures.join() such that

Futures.join(p1,s2,s3,p3, {timeout: 0}).fail(function () {
    Futures.log("Holy Freakin' Fast Failure!");
});

Futures.join([p1,s2,s3,p3], {timeout: 0}).fail(function () {
    Futures.log("Holy Freakin' Fast Failure!");
});



PROPOSED (please comment):

To me it would almost make sense also to have except that I like having immediates as a shortcut to Futures.promise().fulfill('data').passable().
Futures.promise({timeout: n})
I plan to add a .cancel(). I saw this on the CommonJS wiki.

It does make sense to me to add a timeout to individual subscriptions
Futures.subscription({timeout: n})

I don't know how useful a timeout would be, but I think I'll implement it such that "All deliveries must have updated at least once in N ms"
Futures.synchronization(s1, s2, s3, {timeout: n})

I plan to add .stop() which will cause deliveries to stop until .resume()
This will reset the subscription to an empty state (data-wise, not callback-wise). 
When .resume() is called, all subscriptions must make at least one delivery before the next synchronized delivery.

I also plan to implement stopUntilNextDelivery() which would be equivalent to .stop().resume()


I haven't grokked the CommonJS proposals yet, but I will this weekend. I'm still coming up with use cases.

AJ ONeal

Tauren Mills

unread,
Jul 27, 2010, 8:31:31 PM7/27/10
to futures-j...@googlegroups.com
I finally got around to testing this, and adding the timeout works perfectly.

Now I'm left wondering what to set the timeout to since browsing from a mobile device might need a much bigger timeout than a hi-speed connection.

Thanks for your work on this!
Tauren


--
Please use prefixes: [Pony] Feature requests, [TestCase] Test cases, [Bug] if you're lazy. If you have contract work or position for FuturesJS devs, prefix [Bounty] or [Job].
-----
To post to this group, send email to futures-j...@googlegroups.com
To unsubscribe from this group, send email to
futures-javascr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/futures-javascript?hl=en

Reply all
Reply to author
Forward
0 new messages