Ejemplo n.º 1
0
 public ActorWorkSchedulerTests()
 {
     _actor = new Actor();
     _actor.Start();
     _scheduler = _actor.CreateWorkScheduler();
 }
 /// <summary>
 /// A wrapper round IActorWorkScheduler.Schedule() that reschedules work after an unxexpected error has occurred in that work.
 /// </summary>
 /// <param name="self">The schedule.</param>
 /// <param name="work">The work to perform repeatedly.</param>
 /// <param name="interval">Interval at which the work is to be repeated.</param>
 /// <param name="options">Options.  See <see cref="ActorScheduleOptions"/> for details.</param>
 /// <param name="unexpectedErrorHandler">Handler for any unexpected exception.</param>
 /// <returns>A task: the only possible completion is due to cancellation.</returns>
 public static Task Schedule(this IActorWorkScheduler self, Func <Task> work, TimeSpan interval, ActorScheduleOptions options, Action <Exception> unexpectedErrorHandler)
 {
     return(ScheduleImpl(self.Schedule(work, interval, options), () => self.Schedule(work, interval, RemoveFlag(options, ActorScheduleOptions.NoInitialDelay)), unexpectedErrorHandler));
 }