-
-
Notifications
You must be signed in to change notification settings - Fork 7.4k
Closed
Labels
Description
Description
By default, the ruby client uses one ApiClient across all threads. This would be fine, but when downloading files, the ApiClient stores the tempfile reference in an instance variable. This leads to a race condition if two threads are making a call to an endpoint that downloads files at the same time, both calls may return the same file. So
Steps to reproduce
In two parallel threads, use the same Api Client to hit endpoints that download different files. It's a race condition, so it won't happen every time.
Suggest a fix/enhancement
Either the ApiClient.default() needs to return a thread-specific API client, or the tempfile needs to be stored in a thread-safe way (either a thread variable or local variable)
Reactions are currently unavailable