Skip to content

Commit

Permalink
Make Bank2Adapter shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
mauroservienti committed Jun 21, 2024
1 parent e4d0e40 commit 4bfe219
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/Bank2Adapter/Handlers/QuoteRequestedHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,20 @@ public async Task Handle(QuoteRequested message, IMessageHandlerContext context)

while (DateTime.Now.Ticks % 300 == 0)
{
if (context.CancellationToken.IsCancellationRequested)
{
return;
}
throw new Exception("Random error");
}

while (DateTime.Now.Ticks % 5 == 0)
{
if (context.CancellationToken.IsCancellationRequested)
{
return;
}

var randomDelayMilliseconds = Random.Next(500, 3000);
Thread.Sleep(randomDelayMilliseconds);
}
Expand Down

0 comments on commit 4bfe219

Please sign in to comment.