From c7624eaf24a14674f9693be37052a1ee10fbcfed Mon Sep 17 00:00:00 2001 From: stidsborg Date: Sun, 4 Aug 2024 10:12:46 +0200 Subject: [PATCH] Rename TimeoutProvider to Timeouts --- .../TestTemplates/CustomMessageSerializerTests.cs | 2 +- .../Messaging/TestTemplates/MessagesTests.cs | 14 +++++++------- .../ReactiveTests/NoOpTimeoutProvider.cs | 4 ++-- .../ReactiveTests/ReactiveIntegrationTests.cs | 2 +- .../ReactiveTests/TestSource.cs | 4 ++-- .../ReactiveTests/TimeoutTests.cs | 10 +++++----- .../RFunctionTests/ControlPanelTests.cs | 8 ++++---- .../TestTemplates/RFunctionTests/TimeoutTests.cs | 2 +- .../TestTemplates/TimeoutStoreTests.cs | 10 +++++----- .../CoreRuntime/Invocation/InvocationHelper.cs | 2 +- .../CoreRuntime/TimeoutProvider.cs | 6 +++--- .../Messaging/Messages.cs | 6 +++--- .../Messaging/MessagesPullerAndEmitter.cs | 4 ++-- .../Reactive/Extensions/LeafOperators.cs | 2 +- .../Reactive/ISubscription.cs | 2 +- .../Reactive/Operators/BufferOperator.cs | 2 +- .../Reactive/Operators/CustomOperator.cs | 2 +- .../Reactive/Operators/TimeoutOperator.cs | 4 ++-- .../Reactive/Origin/Source.cs | 8 ++++---- .../Reactive/Origin/SourceSubscription.cs | 6 +++--- .../Reactive/TimeoutExtensions.cs | 6 +++--- 21 files changed, 53 insertions(+), 53 deletions(-) diff --git a/Core/Cleipnir.ResilientFunctions.Tests/Messaging/TestTemplates/CustomMessageSerializerTests.cs b/Core/Cleipnir.ResilientFunctions.Tests/Messaging/TestTemplates/CustomMessageSerializerTests.cs index 58fab33d..28d99ae4 100644 --- a/Core/Cleipnir.ResilientFunctions.Tests/Messaging/TestTemplates/CustomMessageSerializerTests.cs +++ b/Core/Cleipnir.ResilientFunctions.Tests/Messaging/TestTemplates/CustomMessageSerializerTests.cs @@ -27,7 +27,7 @@ await functionStore.CreateFunction( ); var eventSerializer = new EventSerializer(); var messagesWriter = new MessageWriter(functionId, functionStore, eventSerializer, scheduleReInvocation: (_, _) => Task.CompletedTask); - var timeoutProvider = new TimeoutProvider(functionId, functionStore.TimeoutStore); + var timeoutProvider = new Timeouts(functionId, functionStore.TimeoutStore); var messagesPullerAndEmitter = new MessagesPullerAndEmitter( functionId, defaultDelay: TimeSpan.FromSeconds(1), diff --git a/Core/Cleipnir.ResilientFunctions.Tests/Messaging/TestTemplates/MessagesTests.cs b/Core/Cleipnir.ResilientFunctions.Tests/Messaging/TestTemplates/MessagesTests.cs index 8076293e..31feed09 100644 --- a/Core/Cleipnir.ResilientFunctions.Tests/Messaging/TestTemplates/MessagesTests.cs +++ b/Core/Cleipnir.ResilientFunctions.Tests/Messaging/TestTemplates/MessagesTests.cs @@ -29,7 +29,7 @@ await functionStore.CreateFunction( timestamp: DateTime.UtcNow.Ticks ); var messagesWriter = new MessageWriter(functionId, functionStore, DefaultSerializer.Instance, scheduleReInvocation: (_, _) => Task.CompletedTask); - var timeoutProvider = new TimeoutProvider(functionId, functionStore.TimeoutStore); + var timeoutProvider = new Timeouts(functionId, functionStore.TimeoutStore); var messagesPullerAndEmitter = new MessagesPullerAndEmitter( functionId, defaultDelay: TimeSpan.FromMilliseconds(250), @@ -64,7 +64,7 @@ await functionStore.CreateFunction( timestamp: DateTime.UtcNow.Ticks ); var messagesWriter = new MessageWriter(functionId, functionStore, DefaultSerializer.Instance, scheduleReInvocation: (_, _) => Task.CompletedTask); - var timeoutProvider = new TimeoutProvider(functionId, functionStore.TimeoutStore); + var timeoutProvider = new Timeouts(functionId, functionStore.TimeoutStore); var messagesPullerAndEmitter = new MessagesPullerAndEmitter( functionId, defaultDelay: TimeSpan.FromMilliseconds(250), @@ -102,7 +102,7 @@ await functionStore.CreateFunction( timestamp: DateTime.UtcNow.Ticks ); var messagesWriter = new MessageWriter(functionId, functionStore, DefaultSerializer.Instance, scheduleReInvocation: (_, _) => Task.CompletedTask); - var timeoutProvider = new TimeoutProvider(functionId, functionStore.TimeoutStore); + var timeoutProvider = new Timeouts(functionId, functionStore.TimeoutStore); var messagesPullerAndEmitter = new MessagesPullerAndEmitter( functionId, defaultDelay: TimeSpan.FromMilliseconds(250), @@ -145,7 +145,7 @@ await functionStore.CreateFunction( timestamp: DateTime.UtcNow.Ticks ); var messagesWriter = new MessageWriter(functionId, functionStore, DefaultSerializer.Instance, scheduleReInvocation: (_, _) => Task.CompletedTask); - var timeoutProvider = new TimeoutProvider(functionId, functionStore.TimeoutStore); + var timeoutProvider = new Timeouts(functionId, functionStore.TimeoutStore); var messagesPullerAndEmitter = new MessagesPullerAndEmitter( functionId, defaultDelay: TimeSpan.FromMilliseconds(250), @@ -187,7 +187,7 @@ await functionStore.CreateFunction( timestamp: DateTime.UtcNow.Ticks ); var messagesWriter = new MessageWriter(functionId, functionStore, DefaultSerializer.Instance, scheduleReInvocation: (_, _) => Task.CompletedTask); - var timeoutProvider = new TimeoutProvider(functionId, functionStore.TimeoutStore); + var timeoutProvider = new Timeouts(functionId, functionStore.TimeoutStore); var messagesPullerAndEmitter = new MessagesPullerAndEmitter( functionId, defaultDelay: TimeSpan.FromMilliseconds(250), @@ -225,7 +225,7 @@ await functionStore.CreateFunction( timestamp: DateTime.UtcNow.Ticks ); var messagesWriter = new MessageWriter(functionId, functionStore, DefaultSerializer.Instance, scheduleReInvocation: (_, _) => Task.CompletedTask); - var timeoutProvider = new TimeoutProvider(functionId, functionStore.TimeoutStore); + var timeoutProvider = new Timeouts(functionId, functionStore.TimeoutStore); var messagesPullerAndEmitter = new MessagesPullerAndEmitter( functionId, defaultDelay: TimeSpan.FromMilliseconds(250), @@ -275,7 +275,7 @@ await functionStore.CreateFunction( timestamp: DateTime.UtcNow.Ticks ); var messagesWriter = new MessageWriter(functionId, functionStore, DefaultSerializer.Instance, scheduleReInvocation: (_, _) => Task.CompletedTask); - var timeoutProvider = new TimeoutProvider(functionId, functionStore.TimeoutStore); + var timeoutProvider = new Timeouts(functionId, functionStore.TimeoutStore); var messagesPullerAndEmitter = new MessagesPullerAndEmitter( functionId, defaultDelay: TimeSpan.FromMilliseconds(250), diff --git a/Core/Cleipnir.ResilientFunctions.Tests/ReactiveTests/NoOpTimeoutProvider.cs b/Core/Cleipnir.ResilientFunctions.Tests/ReactiveTests/NoOpTimeoutProvider.cs index d808fd19..0f0f617a 100644 --- a/Core/Cleipnir.ResilientFunctions.Tests/ReactiveTests/NoOpTimeoutProvider.cs +++ b/Core/Cleipnir.ResilientFunctions.Tests/ReactiveTests/NoOpTimeoutProvider.cs @@ -7,9 +7,9 @@ namespace Cleipnir.ResilientFunctions.Tests.ReactiveTests; -public class NoOpTimeoutProvider : ITimeoutProvider +public class NoOpTimeouts : ITimeouts { - public static NoOpTimeoutProvider Instance { get; } = new(); + public static NoOpTimeouts Instance { get; } = new(); public Task RegisterTimeout(string timeoutId, DateTime expiresAt) => Task.CompletedTask; diff --git a/Core/Cleipnir.ResilientFunctions.Tests/ReactiveTests/ReactiveIntegrationTests.cs b/Core/Cleipnir.ResilientFunctions.Tests/ReactiveTests/ReactiveIntegrationTests.cs index ab8c8de9..f11d2b44 100644 --- a/Core/Cleipnir.ResilientFunctions.Tests/ReactiveTests/ReactiveIntegrationTests.cs +++ b/Core/Cleipnir.ResilientFunctions.Tests/ReactiveTests/ReactiveIntegrationTests.cs @@ -42,7 +42,7 @@ public async Task SyncingStopsAfterReactiveChainCompletion() var counter = new SyncedCounter(); var source = new TestSource( - NoOpTimeoutProvider.Instance, + NoOpTimeouts.Instance, syncStore: _ => { counter.Increment(); diff --git a/Core/Cleipnir.ResilientFunctions.Tests/ReactiveTests/TestSource.cs b/Core/Cleipnir.ResilientFunctions.Tests/ReactiveTests/TestSource.cs index 5bd57c86..0868de7b 100644 --- a/Core/Cleipnir.ResilientFunctions.Tests/ReactiveTests/TestSource.cs +++ b/Core/Cleipnir.ResilientFunctions.Tests/ReactiveTests/TestSource.cs @@ -9,8 +9,8 @@ namespace Cleipnir.ResilientFunctions.Tests.ReactiveTests; public class TestSource : Source { - public TestSource(ITimeoutProvider? timeoutProvider = null, SyncStore? syncStore = null) : base( - timeoutProvider ?? NoOpTimeoutProvider.Instance, + public TestSource(ITimeouts? timeoutProvider = null, SyncStore? syncStore = null) : base( + timeoutProvider ?? NoOpTimeouts.Instance, syncStore: syncStore ?? (_ => new InterruptCount(0).ToTask()), defaultDelay: TimeSpan.FromMilliseconds(10), defaultMaxWait: TimeSpan.MaxValue, diff --git a/Core/Cleipnir.ResilientFunctions.Tests/ReactiveTests/TimeoutTests.cs b/Core/Cleipnir.ResilientFunctions.Tests/ReactiveTests/TimeoutTests.cs index 75e01016..71796e99 100644 --- a/Core/Cleipnir.ResilientFunctions.Tests/ReactiveTests/TimeoutTests.cs +++ b/Core/Cleipnir.ResilientFunctions.Tests/ReactiveTests/TimeoutTests.cs @@ -22,7 +22,7 @@ public async Task StreamCompletesAndThrowsNoResultExceptionAfterFiredTimeoutEven var timeoutId = "TimeoutId"; var expiresAt = DateTime.UtcNow.Add(TimeSpan.FromMinutes(15)); - var timeoutProviderStub = new TimeoutProviderStub(); + var timeoutProviderStub = new TimeoutsStub(); var source = new TestSource(timeoutProviderStub); var task = source.TakeUntilTimeout(timeoutId, expiresAt).First(); @@ -47,7 +47,7 @@ public async Task StreamCompletesAndReturnsNothingAfterFiredTimeoutEvent() var timeoutId = "TimeoutId"; var expiresAt = DateTime.UtcNow.Add(TimeSpan.FromMinutes(15)); - var timeoutProviderStub = new TimeoutProviderStub(); + var timeoutProviderStub = new TimeoutsStub(); var source = new TestSource(timeoutProviderStub); var task = source.TakeUntilTimeout(timeoutId, expiresAt).FirstOrNone(); @@ -73,7 +73,7 @@ public async Task StreamCompletesSuccessfullyWhenEventSupersedesTimeout() var timeoutId = "TimeoutId"; var expiresAt = DateTime.UtcNow.Add(TimeSpan.FromMinutes(15)); - var timeoutProviderStub = new TimeoutProviderStub(); + var timeoutProviderStub = new TimeoutsStub(); var source = new TestSource(timeoutProviderStub); var task = source.TakeUntilTimeout(timeoutId, expiresAt).First(); @@ -91,7 +91,7 @@ public async Task StreamCompletesSuccessfullyWithValuedOptionWhenEventSupersedes var timeoutId = "TimeoutId"; var expiresAt = DateTime.UtcNow.Add(TimeSpan.FromMinutes(15)); - var timeoutProviderStub = new TimeoutProviderStub(); + var timeoutProviderStub = new TimeoutsStub(); var source = new TestSource(timeoutProviderStub); var task = source.TakeUntilTimeout(timeoutId, expiresAt).FirstOrNone(); @@ -105,7 +105,7 @@ public async Task StreamCompletesSuccessfullyWithValuedOptionWhenEventSupersedes option.Value.ShouldBe("Hello"); } - private class TimeoutProviderStub : ITimeoutProvider + private class TimeoutsStub : ITimeouts { public List> Registrations { diff --git a/Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/RFunctionTests/ControlPanelTests.cs b/Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/RFunctionTests/ControlPanelTests.cs index 6c0ade3f..ac7f2411 100644 --- a/Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/RFunctionTests/ControlPanelTests.cs +++ b/Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/RFunctionTests/ControlPanelTests.cs @@ -35,7 +35,7 @@ protected async Task ExistingActionCanBeDeletedFromControlPanel(Task(); state.Value = "State"; - await workflow.Messages.TimeoutProvider.RegisterTimeout("Timeout", TimeSpan.FromDays(1)); + await workflow.Messages.Timeouts.RegisterTimeout("Timeout", TimeSpan.FromDays(1)); await state.Save(); } ); @@ -96,7 +96,7 @@ async Task(string _, Workflow workflow) => var state = states.CreateOrGet(); state.Value = "State"; await state.Save(); - await workflow.Messages.TimeoutProvider.RegisterTimeout("Timeout", TimeSpan.FromDays(1)); + await workflow.Messages.Timeouts.RegisterTimeout("Timeout", TimeSpan.FromDays(1)); return "hello"; }); @@ -1478,7 +1478,7 @@ protected async Task ExistingTimeoutCanBeUpdatedForAction(Task s var actionRegistration = functionsRegistry.RegisterAction( flowType, Task (string param, Workflow workflow) => - workflow.Messages.TimeoutProvider.RegisterTimeout( + workflow.Messages.Timeouts.RegisterTimeout( "someTimeoutId", expiresAt: new DateTime(2100, 1,1, 1,1,1, DateTimeKind.Utc) ) ); @@ -1518,7 +1518,7 @@ protected async Task ExistingTimeoutCanBeUpdatedForFunc(Task sto flowType, async Task (string param, Workflow workflow) => { - await workflow.Messages.TimeoutProvider.RegisterTimeout( + await workflow.Messages.Timeouts.RegisterTimeout( "someTimeoutId", expiresAt: new DateTime(2100, 1, 1, 1, 1, 1, DateTimeKind.Utc) ); diff --git a/Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/RFunctionTests/TimeoutTests.cs b/Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/RFunctionTests/TimeoutTests.cs index 893bd060..29dda75f 100644 --- a/Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/RFunctionTests/TimeoutTests.cs +++ b/Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/RFunctionTests/TimeoutTests.cs @@ -34,7 +34,7 @@ protected async Task ExpiredTimeoutIsAddedToMessages(Task storeT { var messages = workflow.Messages; var timeoutTask = messages.OfType().First(); - await messages.TimeoutProvider.RegisterTimeout("test", expiresIn: TimeSpan.FromMilliseconds(500)); + await messages.Timeouts.RegisterTimeout("test", expiresIn: TimeSpan.FromMilliseconds(500)); timeoutTask.IsCompleted.ShouldBeFalse(); var timeout = await timeoutTask; timeout.TimeoutId.ShouldBe("test"); diff --git a/Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/TimeoutStoreTests.cs b/Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/TimeoutStoreTests.cs index 14b24e4f..b73cf686 100644 --- a/Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/TimeoutStoreTests.cs +++ b/Core/Cleipnir.ResilientFunctions.Tests/TestTemplates/TimeoutStoreTests.cs @@ -99,7 +99,7 @@ protected async Task RegisteredTimeoutIsReturnedFromTimeoutProvider(Task upsertCount++); var functionId = TestFlowId.Create(); - var timeoutProvider = new TimeoutProvider(functionId, store); + var timeoutProvider = new Timeouts(functionId, store); await timeoutProvider.RegisterTimeout("timeoutId1", expiresIn: TimeSpan.FromHours(1)); upsertCount.ShouldBe(1); @@ -172,7 +172,7 @@ protected async Task CancellingNonExistingTimeoutDoesNotResultInIO(Task removeCount++); var functionId = TestFlowId.Create(); - var timeoutProvider = new TimeoutProvider(functionId, store); + var timeoutProvider = new Timeouts(functionId, store); var pendingTimeouts = await timeoutProvider.PendingTimeouts(); pendingTimeouts.ShouldBeEmpty(); diff --git a/Core/Cleipnir.ResilientFunctions/CoreRuntime/Invocation/InvocationHelper.cs b/Core/Cleipnir.ResilientFunctions/CoreRuntime/Invocation/InvocationHelper.cs index a2a31bb5..499027ca 100644 --- a/Core/Cleipnir.ResilientFunctions/CoreRuntime/Invocation/InvocationHelper.cs +++ b/Core/Cleipnir.ResilientFunctions/CoreRuntime/Invocation/InvocationHelper.cs @@ -363,7 +363,7 @@ await _functionStore.BulkScheduleFunctions( public Messages CreateMessages(FlowId flowId, ScheduleReInvocation scheduleReInvocation, Func isWorkflowRunning) { var messageWriter = new MessageWriter(flowId, _functionStore, Serializer, scheduleReInvocation); - var timeoutProvider = new TimeoutProvider(flowId, _functionStore.TimeoutStore); + var timeoutProvider = new Timeouts(flowId, _functionStore.TimeoutStore); var messagesPullerAndEmitter = new MessagesPullerAndEmitter( flowId, defaultDelay: _settings.MessagesPullFrequency, diff --git a/Core/Cleipnir.ResilientFunctions/CoreRuntime/TimeoutProvider.cs b/Core/Cleipnir.ResilientFunctions/CoreRuntime/TimeoutProvider.cs index 328ec0c7..3cf66186 100644 --- a/Core/Cleipnir.ResilientFunctions/CoreRuntime/TimeoutProvider.cs +++ b/Core/Cleipnir.ResilientFunctions/CoreRuntime/TimeoutProvider.cs @@ -8,7 +8,7 @@ namespace Cleipnir.ResilientFunctions.CoreRuntime; -public interface ITimeoutProvider +public interface ITimeouts { Task RegisterTimeout(string timeoutId, DateTime expiresAt); Task RegisterTimeout(string timeoutId, TimeSpan expiresIn); @@ -16,7 +16,7 @@ public interface ITimeoutProvider Task> PendingTimeouts(); } -public class TimeoutProvider : ITimeoutProvider +public class Timeouts : ITimeouts { private readonly ITimeoutStore _timeoutStore; @@ -25,7 +25,7 @@ public class TimeoutProvider : ITimeoutProvider private readonly FlowId _flowId; - public TimeoutProvider(FlowId flowId, ITimeoutStore timeoutStore) + public Timeouts(FlowId flowId, ITimeoutStore timeoutStore) { _timeoutStore = timeoutStore; _flowId = flowId; diff --git a/Core/Cleipnir.ResilientFunctions/Messaging/Messages.cs b/Core/Cleipnir.ResilientFunctions/Messaging/Messages.cs index 8e3b7592..d39afc8a 100644 --- a/Core/Cleipnir.ResilientFunctions/Messaging/Messages.cs +++ b/Core/Cleipnir.ResilientFunctions/Messaging/Messages.cs @@ -7,7 +7,7 @@ namespace Cleipnir.ResilientFunctions.Messaging; public class Messages : IReactiveChain { - public TimeoutProvider TimeoutProvider { get; } + public Timeouts Timeouts { get; } public IReactiveChain Source => _messagePullerAndEmitter.Source; private readonly MessageWriter _messageWriter; @@ -15,12 +15,12 @@ public class Messages : IReactiveChain public Messages( MessageWriter messageWriter, - TimeoutProvider timeoutProvider, + Timeouts timeouts, MessagesPullerAndEmitter messagePullerAndEmitter ) { _messageWriter = messageWriter; - TimeoutProvider = timeoutProvider; + Timeouts = timeouts; _messagePullerAndEmitter = messagePullerAndEmitter; } diff --git a/Core/Cleipnir.ResilientFunctions/Messaging/MessagesPullerAndEmitter.cs b/Core/Cleipnir.ResilientFunctions/Messaging/MessagesPullerAndEmitter.cs index 91ccdc64..f36a2e70 100644 --- a/Core/Cleipnir.ResilientFunctions/Messaging/MessagesPullerAndEmitter.cs +++ b/Core/Cleipnir.ResilientFunctions/Messaging/MessagesPullerAndEmitter.cs @@ -46,7 +46,7 @@ public MessagesPullerAndEmitter( TimeSpan defaultDelay, TimeSpan defaultMaxWait, Func isWorkflowRunning, - IFunctionStore functionStore, ISerializer serializer, ITimeoutProvider timeoutProvider) + IFunctionStore functionStore, ISerializer serializer, ITimeouts timeouts) { _flowId = flowId; _functionStore = functionStore; @@ -55,7 +55,7 @@ public MessagesPullerAndEmitter( _serializer = serializer; Source = new Source( - timeoutProvider, + timeouts, syncStore: PullEvents, defaultDelay, defaultMaxWait, diff --git a/Core/Cleipnir.ResilientFunctions/Reactive/Extensions/LeafOperators.cs b/Core/Cleipnir.ResilientFunctions/Reactive/Extensions/LeafOperators.cs index fd518b92..75f13293 100644 --- a/Core/Cleipnir.ResilientFunctions/Reactive/Extensions/LeafOperators.cs +++ b/Core/Cleipnir.ResilientFunctions/Reactive/Extensions/LeafOperators.cs @@ -156,7 +156,7 @@ public static async Task SuspendUntil(this Messages s, string timeoutEventId, Da if (timeoutEmitted) return; - await subscription.TimeoutProvider.RegisterTimeout(timeoutEventId, resumeAt); + await subscription.Timeouts.RegisterTimeout(timeoutEventId, resumeAt); throw new SuspendInvocationException(interruptCount); } diff --git a/Core/Cleipnir.ResilientFunctions/Reactive/ISubscription.cs b/Core/Cleipnir.ResilientFunctions/Reactive/ISubscription.cs index 17ba59eb..6c865289 100644 --- a/Core/Cleipnir.ResilientFunctions/Reactive/ISubscription.cs +++ b/Core/Cleipnir.ResilientFunctions/Reactive/ISubscription.cs @@ -9,7 +9,7 @@ public interface ISubscription { bool IsWorkflowRunning { get; } IReactiveChain Source { get; } - ITimeoutProvider TimeoutProvider { get; } + ITimeouts Timeouts { get; } TimeSpan DefaultMessageSyncDelay { get; } TimeSpan DefaultMessageMaxWait { get; } diff --git a/Core/Cleipnir.ResilientFunctions/Reactive/Operators/BufferOperator.cs b/Core/Cleipnir.ResilientFunctions/Reactive/Operators/BufferOperator.cs index 82808f92..5c915ff3 100644 --- a/Core/Cleipnir.ResilientFunctions/Reactive/Operators/BufferOperator.cs +++ b/Core/Cleipnir.ResilientFunctions/Reactive/Operators/BufferOperator.cs @@ -55,7 +55,7 @@ public Subscription( public bool IsWorkflowRunning => _subscription.IsWorkflowRunning; public IReactiveChain Source => _subscription.Source; - public ITimeoutProvider TimeoutProvider => _subscription.TimeoutProvider; + public ITimeouts Timeouts => _subscription.Timeouts; public Task Initialize() => _subscription.Initialize(); public Task SyncStore(TimeSpan maxSinceLastSynced) => _subscription.SyncStore(maxSinceLastSynced); diff --git a/Core/Cleipnir.ResilientFunctions/Reactive/Operators/CustomOperator.cs b/Core/Cleipnir.ResilientFunctions/Reactive/Operators/CustomOperator.cs index a92137f3..7272f3ce 100644 --- a/Core/Cleipnir.ResilientFunctions/Reactive/Operators/CustomOperator.cs +++ b/Core/Cleipnir.ResilientFunctions/Reactive/Operators/CustomOperator.cs @@ -68,7 +68,7 @@ public Subscription( _innerSubscription = inner.Subscribe(OnNext, OnCompletion, OnError); } - public ITimeoutProvider TimeoutProvider => _innerSubscription.TimeoutProvider; + public ITimeouts Timeouts => _innerSubscription.Timeouts; public Task Initialize() => _innerSubscription.Initialize(); diff --git a/Core/Cleipnir.ResilientFunctions/Reactive/Operators/TimeoutOperator.cs b/Core/Cleipnir.ResilientFunctions/Reactive/Operators/TimeoutOperator.cs index 31f88c03..7962c696 100644 --- a/Core/Cleipnir.ResilientFunctions/Reactive/Operators/TimeoutOperator.cs +++ b/Core/Cleipnir.ResilientFunctions/Reactive/Operators/TimeoutOperator.cs @@ -77,7 +77,7 @@ public async Task RegisterTimeoutIfNotInExistingEvents() try { - await _innerSubscription.TimeoutProvider.RegisterTimeout(_timeoutId, _expiresAt); + await _innerSubscription.Timeouts.RegisterTimeout(_timeoutId, _expiresAt); } catch (Exception exception) { @@ -87,7 +87,7 @@ public async Task RegisterTimeoutIfNotInExistingEvents() public bool IsWorkflowRunning => _innerSubscription.IsWorkflowRunning; public IReactiveChain Source => _innerSubscription.Source; - public ITimeoutProvider TimeoutProvider => _innerSubscription.TimeoutProvider; + public ITimeouts Timeouts => _innerSubscription.Timeouts; public async Task Initialize() { diff --git a/Core/Cleipnir.ResilientFunctions/Reactive/Origin/Source.cs b/Core/Cleipnir.ResilientFunctions/Reactive/Origin/Source.cs index eca95c1f..65ab9e41 100644 --- a/Core/Cleipnir.ResilientFunctions/Reactive/Origin/Source.cs +++ b/Core/Cleipnir.ResilientFunctions/Reactive/Origin/Source.cs @@ -11,7 +11,7 @@ public class Source : IReactiveChain { private bool _completed; - private readonly ITimeoutProvider _timeoutProvider; + private readonly ITimeouts _timeouts; private readonly SyncStore _syncStore; private readonly TimeSpan _defaultDelay; private readonly TimeSpan _defaultMaxWait; @@ -34,7 +34,7 @@ public IEnumerable Existing } public Source( - ITimeoutProvider timeoutProvider, + ITimeouts timeouts, SyncStore syncStore, TimeSpan defaultDelay, TimeSpan defaultMaxWait, @@ -42,7 +42,7 @@ public Source( Func initialSyncPerformed ) { - _timeoutProvider = timeoutProvider; + _timeouts = timeouts; _syncStore = syncStore; _defaultDelay = defaultDelay; @@ -56,7 +56,7 @@ public ISubscription Subscribe(Action onNext, Action onCompletion, Actio var subscription = new SourceSubscription( onNext, onCompletion, onError, source: this, - _emittedEvents, _syncStore, _initialSyncPerformed, _isWorkflowRunning, _timeoutProvider, + _emittedEvents, _syncStore, _initialSyncPerformed, _isWorkflowRunning, _timeouts, _defaultDelay, _defaultMaxWait ); diff --git a/Core/Cleipnir.ResilientFunctions/Reactive/Origin/SourceSubscription.cs b/Core/Cleipnir.ResilientFunctions/Reactive/Origin/SourceSubscription.cs index 5254bba8..ecda09ce 100644 --- a/Core/Cleipnir.ResilientFunctions/Reactive/Origin/SourceSubscription.cs +++ b/Core/Cleipnir.ResilientFunctions/Reactive/Origin/SourceSubscription.cs @@ -19,7 +19,7 @@ internal class SourceSubscription : ISubscription private readonly Func _isWorkflowRunning; public bool IsWorkflowRunning => _isWorkflowRunning(); public IReactiveChain Source { get; } - public ITimeoutProvider TimeoutProvider { get; } + public ITimeouts Timeouts { get; } public TimeSpan DefaultMessageSyncDelay { get; } public TimeSpan DefaultMessageMaxWait { get; } @@ -30,7 +30,7 @@ public SourceSubscription( SyncStore syncStore, Func initialSyncPerformed, Func isWorkflowRunning, - ITimeoutProvider timeoutProvider, + ITimeouts timeouts, TimeSpan defaultDelay, TimeSpan defaultMessageMaxWait ) @@ -43,7 +43,7 @@ TimeSpan defaultMessageMaxWait _syncStore = syncStore; _initialSyncPerformed = initialSyncPerformed; _isWorkflowRunning = isWorkflowRunning; - TimeoutProvider = timeoutProvider; + Timeouts = timeouts; DefaultMessageSyncDelay = defaultDelay; DefaultMessageMaxWait = defaultMessageMaxWait; } diff --git a/Core/Cleipnir.ResilientFunctions/Reactive/TimeoutExtensions.cs b/Core/Cleipnir.ResilientFunctions/Reactive/TimeoutExtensions.cs index 56831be3..c9227566 100644 --- a/Core/Cleipnir.ResilientFunctions/Reactive/TimeoutExtensions.cs +++ b/Core/Cleipnir.ResilientFunctions/Reactive/TimeoutExtensions.cs @@ -12,19 +12,19 @@ public static class TimeoutExtensions public static async Task RegisterTimeoutEvent(this Messages messages, string timeoutId, DateTime expiresAt) { if (!DoesMessagesAlreadyContainTimeoutEvent(messages, timeoutId)) - await messages.TimeoutProvider.RegisterTimeout(timeoutId, expiresAt); + await messages.Timeouts.RegisterTimeout(timeoutId, expiresAt); } public static async Task RegisterTimeoutEvent(this Messages messages, string timeoutId, TimeSpan expiresIn) { if (!DoesMessagesAlreadyContainTimeoutEvent(messages, timeoutId)) - await messages.TimeoutProvider.RegisterTimeout(timeoutId, expiresIn); + await messages.Timeouts.RegisterTimeout(timeoutId, expiresIn); } public static async Task CancelTimeoutEvent(this Messages messages, string timeoutId) { if (!DoesMessagesAlreadyContainTimeoutEvent(messages, timeoutId)) - await messages.TimeoutProvider.CancelTimeout(timeoutId); + await messages.Timeouts.CancelTimeout(timeoutId); } private static bool DoesMessagesAlreadyContainTimeoutEvent(Messages messages, string timeoutId)