Azure / azure-storage-ruby

Microsoft Azure Storage Library for Ruby
http://azure.github.io/azure-storage-ruby/
84 stars 150 forks source link

Reusing the same service object in multithread server okay? #192

Open StochasticSpring opened 3 years ago

StochasticSpring commented 3 years ago

I could not find any mention of thread safety in general within the documentation. Specifically in my use case is it okay to do something like:

# application setup
BLOB_SERVICE = Azure::Storage::Blob::BlobService.create(...)
QUEUE_SERVICE = Azure::Storage::Queue::QueueService.create(...)
...
# multiple threads calling these as part our Puma server responding to requests
blob, contents = BLOB_SERVICE.get_blob(...)
BLOB_SERVICE.create_block_blob(...)
QUEUE_SERVICE.create_message(...)

Or should I be creating a new BlobService, QueueService, etc. object every time?