-
Notifications
You must be signed in to change notification settings - Fork 2
Open
Description
I encountered a crash in CommandListenerHostedService due to a race condition in MatrixHttpClient.SendAsync.
fail: LibMatrix.Utilities.Bot.Services.CommandListenerHostedService[0]
Failed to sync!
System.IndexOutOfRangeException: Index was outside the bounds of the array.
at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
at LibMatrix.Extensions.MatrixHttpClient.SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
at LibMatrix.Extensions.MatrixHttpClient.GetFromJsonAsync[T](String requestUri, JsonSerializerOptions options, CancellationToken cancellationToken)
at LibMatrix.Helpers.SyncHelper.SyncAsyncInternal(Nullable`1 cancellationToken, Boolean noDelay)
Could you change
private Dictionary<HttpRequestMessage, int> _retries = []; to ConcurrentDictionary or add locking logic to prevent race conditions?
Thank you for your great job!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels