Skip to content

Commit

Permalink
bump orleans 8.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
suraciii committed Jul 15, 2024
1 parent 544dfa1 commit e225885
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<ManagePackageVersionsCentrally>true</ManagePackageVersionsCentrally>
</PropertyGroup>
<PropertyGroup>
<OrleansVersion>8.1.0</OrleansVersion>
<OrleansVersion>8.2.0</OrleansVersion>
<MExVersion>8.0.0</MExVersion>
<DCAExtensionsVersion>0.0.1-alpha4.1</DCAExtensionsVersion>
<OtelVersion>1.9.0</OtelVersion>
Expand Down
7 changes: 3 additions & 4 deletions src/Fabron.Core/Schedulers/SchedulerGrain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -175,12 +175,11 @@ protected async Task StopTicker()

protected void FireAfter(FireEnvelop envelop, TimeSpan dueTime)
{
_runtime.TimerRegistry.RegisterTimer(
_runtime.TimerRegistry.RegisterGrainTimer(
GrainContext,
obj => DispatchNew((FireEnvelop)obj),
(obj, ct) => DispatchNew(obj),
envelop,
dueTime,
Timeout.InfiniteTimeSpan);
new GrainTimerCreationOptions { DueTime = dueTime, Period = Timeout.InfiniteTimeSpan });
TickerLog.TimerSet(_logger, _key, dueTime, envelop.Time);
}

Expand Down
25 changes: 16 additions & 9 deletions test/Fabron.Core.Test/SchedulerTests/FakeTimerRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,29 @@ namespace Fabron.Core.Test.SchedulerTests
{
public class FakeTimerRegistry : ITimerRegistry
{
public List<FakeTimer> Timers { get; } = [];
public IDisposable RegisterTimer(IGrainContext grainContext, Func<object, Task> asyncCallback, object state, TimeSpan dueTime, TimeSpan period)
public List<FakeGrainTimer> Timers { get; } = [];

public IGrainTimer RegisterGrainTimer<TState>(IGrainContext grainContext, Func<TState, CancellationToken, Task> callback, TState state, GrainTimerCreationOptions options)
{
var timer = new FakeTimer(asyncCallback, state, dueTime, period);
var timer = new FakeGrainTimer((obj, ct) => callback(state, ct), state, options);
Timers.Add(timer);
return timer;
}

public IDisposable RegisterTimer(IGrainContext grainContext, Func<object?, Task> asyncCallback, object? state, TimeSpan dueTime, TimeSpan period) => throw new NotImplementedException();
}

public record FakeTimer(
Func<object, Task> AsyncCallback,
object State,
TimeSpan DueTime,
TimeSpan Period) : IDisposable
public class FakeGrainTimer(
Func<object?, CancellationToken, Task> AsyncCallback,
object? State,
GrainTimerCreationOptions Options) : IGrainTimer
{
public Task Trigger() => AsyncCallback(State);
public TimeSpan DueTime => Options.DueTime;

public TimeSpan Period => Options.Period;

public Task Trigger() => AsyncCallback(State, default);
public void Dispose() { }
public void Change(TimeSpan dueTime, TimeSpan period) => throw new NotImplementedException();
}
}

0 comments on commit e225885

Please sign in to comment.