I have a requirement where after an initial delay of 10 seconds, I need to execute SomeMethod at every 10 minutes, but with a catch that 10 minute timer should start after the completion of SomeMethod. Here is the crude example:
Start Task 00:00:00 (10 second delay) SomeMethod executed at 00:00:10 (takes 15 minutes) (10 minute delay) SomeMethod executed at 00:25:10 ... and so on. I know how to do this using TPL. I can start the task using Task.Delay and execute SomeMethod and then after every completion (ContinueWith TaskStatus.RanToCompletion), I create a new task and execute SomeMethod again.
My question is that is this possible using Observable.Timer? Something like...
Observable.Timer(TimeSpan.FromSeconds(10), TimeSpan.FromMinutes(10)) The problem with this code is that if SomeMethod takes 15 minutes, I will have two different SomeMethod instances running, which I don't want. I want the 10 minute timer to start after SomeMethod completes. Is this possible using Observable or should I stay with TPL?
EDIT: Forgot to mention that I want SomeMethod to run in it's own thread.