divyang4481 / retlang

Automatically exported from code.google.com/p/retlang
0 stars 0 forks source link

SubscribeToBatch and IScheduler should use TimeSpan instead of long #12

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
The TimeSpan struct is much more useful for writing comprehensible code, and it 
is already used in the .Net libraries for thread scheduling.

I would much rather write something like this:

    channel.SubscribeToBatch(fiber, this.DoSomething, TimeSpan.FromMinutes(1));

than something like this:

    channel.SubscribeToBatch(fiber, this.DoSomething, 1000 * 60);

It also avoids the inconsistency you have from SubscribeToBatch (using 
int/Int32) and Scheduler (using long/Int64).

Original issue reported on code.google.com by blorit...@gmail.com on 22 Mar 2011 at 5:32

GoogleCodeExporter commented 9 years ago
Thanks for pointing out the inconsistency.  I will at the very least switch to 
both using longs.

Using TimeSpan does look like it might provide a cleaner API.  I will look into 
it.

Original comment by graham.m...@gmail.com on 22 Mar 2011 at 6:57

GoogleCodeExporter commented 9 years ago
TimeSpan does not have an infinite value.  This is needed to express indefinite 
timeouts (currently signified by Timeout.Infinite).

Unfortunately this prevents a conversion.

Original comment by graham.m...@gmail.com on 18 May 2011 at 10:03