Skip to content

Commit

Permalink
Use RegisterGrainTimer instead of obsolete RegisterTimer
Browse files Browse the repository at this point in the history
  • Loading branch information
egil committed Jan 18, 2025
1 parent e8ec057 commit adc1432
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions orleans/Adventure/AdventureGrains/MonsterGrain.cs
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
using AdventureGrainInterfaces;
using AdventureGrainInterfaces;

namespace AdventureGrains;

public class MonsterGrain : Grain, IMonsterGrain
public class MonsterGrain : Grain, IMonsterGrain, IDisposable
{
private MonsterInfo _monsterInfo = new();
private IGrainTimer? _timer;
private IRoomGrain? _roomGrain; // Current room

public override Task OnActivateAsync(CancellationToken cancellationToken)
{
_monsterInfo = _monsterInfo with { Id = this.GetPrimaryKeyLong() };

RegisterTimer(
_timer = RegisterGrainTimer(

Check failure on line 15 in orleans/Adventure/AdventureGrains/MonsterGrain.cs

View workflow job for this annotation

GitHub Actions / snippets-build

D:\a\samples\samples\orleans\Adventure\AdventureGrains\MonsterGrain.cs(15,18): error CS0103: The name 'RegisterGrainTimer' does not exist in the current context [D:\a\samples\samples\orleans\Adventure\AdventureGrains\AdventureGrains.csproj]
_ => Move(),
null!,
TimeSpan.FromSeconds(150),
TimeSpan.FromMinutes(150));

return base.OnActivateAsync(cancellationToken);
}

public void Dispose() => _timer?.Dispose();

Task IMonsterGrain.SetInfo(MonsterInfo info)
{
_monsterInfo = info;
Expand Down

0 comments on commit adc1432

Please sign in to comment.