Skip to content

Commit

Permalink
Implement retry
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-dmxc committed Jan 27, 2024
1 parent 0f61d42 commit cc58ad4
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions RDMSharp/RDM/AsyncRDMRequestHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,16 @@ public async Task<RDMMessage> RequestParameter(RDMMessage requerst)
buffer.TryAdd(requerst, null);
RDMMessage resopnse = null;
_sendMethode.Invoke(requerst);
int count = 0;
do
{
buffer.TryGetValue(requerst, out resopnse);
await Task.Delay(10);
count++;
if (count % 300 == 299)
_sendMethode.Invoke(requerst);
if(count == 3000)
throw new TimeoutException();
}
while (resopnse == null);
buffer.TryRemove(requerst, out resopnse);
Expand Down

0 comments on commit cc58ad4

Please sign in to comment.