-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added support for timeouts in Ask operations
- Loading branch information
1 parent
b8d6cf8
commit 727a739
Showing
9 changed files
with
163 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
| ||
namespace Nixie.Tests.Actors; | ||
|
||
public sealed class ReplySlowActor : IActor<string, string> | ||
{ | ||
private readonly Dictionary<string, int> receivedMessages = new(); | ||
|
||
public ReplySlowActor(IActorContext<ReplySlowActor, string, string> _) | ||
{ | ||
|
||
} | ||
|
||
public int GetMessages(string id) | ||
{ | ||
if (receivedMessages.TryGetValue(id, out int number)) | ||
return number; | ||
|
||
return 0; | ||
} | ||
|
||
public void IncrMessage(string id) | ||
{ | ||
if (!receivedMessages.ContainsKey(id)) | ||
receivedMessages.Add(id, 1); | ||
else | ||
receivedMessages[id]++; | ||
} | ||
|
||
public async Task<string> Receive(string message) | ||
{ | ||
IncrMessage(message); | ||
|
||
await Task.Delay(2000); | ||
|
||
return message; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
| ||
namespace Nixie; | ||
|
||
public class AskTimeoutException : NixieException | ||
{ | ||
public AskTimeoutException(string message) : base(message) | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters