From cc58ad458ee83604a5fac7ecc5e0f26d1798b306 Mon Sep 17 00:00:00 2001 From: Patrick Grote Date: Sat, 27 Jan 2024 03:07:07 +0100 Subject: [PATCH] Implement retry --- RDMSharp/RDM/AsyncRDMRequestHelper.cs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/RDMSharp/RDM/AsyncRDMRequestHelper.cs b/RDMSharp/RDM/AsyncRDMRequestHelper.cs index ccf92ac..b5f2a36 100644 --- a/RDMSharp/RDM/AsyncRDMRequestHelper.cs +++ b/RDMSharp/RDM/AsyncRDMRequestHelper.cs @@ -32,10 +32,16 @@ public async Task 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);