Skip to content

Instantly share code, notes, and snippets.

@Redth
Last active August 29, 2015 14:07
Show Gist options
  • Save Redth/91a8c4b9f29a1312d3f5 to your computer and use it in GitHub Desktop.
Save Redth/91a8c4b9f29a1312d3f5 to your computer and use it in GitHub Desktop.
var toSend = from n in Broker.TakeMany ()
select Connection.Send (n);
await Task.WhenAll (toSend).ConfigureAwait (false);
foreach (var t in toSend) {
await t; //Probably a no-op, should return immediately in any case
if (t.Exception != null)
Broker.RaiseNotificationSucceeded (null); // Need to pass back 'n' here
else
Broker.RaiseNotificationFailed (null, t.Exception);
}
// Connection.Send:
public async Task<INotification> Send (INotification notification)
{
await Task.Delay (500).ConfigureAwait (false);
return notification;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment