Tx icon indicating copy to clipboard operation
Tx copied to clipboard

Playback throws NotImplementedException when using Delay()

Open CodeTao opened this issue 7 years ago • 3 comments

Playback.GetObservable() throws a NotImplementedException when the Delay() operator is used.

    using (var playback = new Playback())
    {
        var evtTime = new DateTimeOffset(2018, 1, 1, 12, 0, 0);

        playback.AddInput(new[] { new Timestamped<object>(evtTime, evtTime) });
        playback.GetObservable<DateTimeOffset>()
            .Delay(TimeSpan.FromSeconds(10), playback.Scheduler)
            .Subscribe(x => Debug.WriteLine($"Data Time: {x}    SchedulerTime: {playback.Scheduler.Now}"));
        playback.Run();
    }

CodeTao avatar Jan 08 '18 14:01 CodeTao

AFAIK there is no code in Tx that throws NotImplementedException. @CodeTao, which version of Tx and Rx are you using?

Tuatan avatar Jan 19 '18 23:01 Tuatan

The sample code above demonstrates the error and the NotImplementedException is thrown in the TimeSegmentScheduler as shown in the source code below.

private sealed class TimeSegmentScheduler : IScheduler
{
   ...
    public DateTimeOffset Now
    {
        get
        {
            if (!_running)
            {
                throw new NotImplementedException();
            }

            return _historical.Clock;
        }
    ...
  }

CodeTao avatar Jan 20 '18 09:01 CodeTao

Seems like the Delay is not supported at the moment since it relies on Now stamp from the scheduler, and at the time of query construction the scheduler is not initialized yet.

Tuatan avatar Jan 24 '18 16:01 Tuatan