public void OnDownstreamFinish() { // Do Nothing until `timeout` to try and intercept completion as downstream, // but cancel stream after timeout if inlet is not closed to prevent deadlock. Materializer.ScheduleOnce(_timeout, () => { var cb = GetAsyncCallback(() => { if (!IsClosed(_nextElem)) { FailStage(new InvalidOperationException($"unfoldFlow source's inner flow canceled only upstream, while downstream remain available for {_timeout}")); } }); cb(); }); }