Inumedia / SlackAPI

.NET Implementation of the Slack team communication platform API.
MIT License
452 stars 243 forks source link

Update RequestPath to use ConcurrentDictionary to mitigate threading issues #190

Closed shadow-cs closed 5 years ago

shadow-cs commented 5 years ago

Closes #189

jhenkens commented 5 years ago

Just saw this PR after experiencing the same issue. Another alternative to switching to ConcurrentDictionary for a use case which will be, after an initial set of requests, primarily read only, is to use a regular dictionary with a clone+swap model for modifications. A lock can be used during the clone+swap, double checking after acquisition (i.e., double-checked locking) before cloning. Just throwing an alternative out there.

Inumedia commented 5 years ago

Hi, I haven't forgotten about this. I keep meaning to make a proof of concept just to actively make sure I wasn't imagining things about TryAdd/AddOrUodate having concurrency problems.

shadow-cs commented 5 years ago

Followup @Inumedia after about three weeks in production I have zero issues with initialization, it looks like the issue is indeed fixed.