[futures] Making ProgressFuture immediate

A common use-case for ProgressFuture will be using the progress values
to drive progress UI for the user.  However, the current design is
flawed for this use-case.  Right now, the progress callback is only
called when the future's resolver posts a new progress update.  That
prevents you from initializing the progress UI with the "current"
progress - you have to wait until the next heartbeat occurs, which may
be an arbitrary amount of time in the future.  This is precisely the
sort of "just missed it" race condition that futures were designed to
avoid.

I propose that we change it so that, if at least one progress update
has already been made and the future isn't yet resolved, the progress
callback is immediately (next tick) called with the most recent
progress value.  That way the progress updates also act kinda like
futures in general, which is nice.

~TJ

Received on Thursday, 11 April 2013 23:06:42 UTC