Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Is B2Client thread-safe? #45

Open
danports opened this issue Apr 22, 2020 · 2 comments
Open

Is B2Client thread-safe? #45

danports opened this issue Apr 22, 2020 · 2 comments

Comments

@danports
Copy link

I'm guessing it is not because of things like this:

_options.UploadAuthorizationToken = uploadUrl.AuthorizationToken;

It would be nice if it were since the underlying HttpClient is, but if that requires too much effort, perhaps a line in the documentation clarifying the library's thread safety would be helpful.

@coryrwest
Copy link
Owner

I am admittedly not as well experienced/read in thread-safety as I could be. I am not sure of the changes require and their extensiveness to be completely thread-safe. I will have to do some research.

@danports
Copy link
Author

From my brief review of the library's internals, I didn't notice many thread safety issues - the only glaring one I noticed is the way that the B2Options class is used to pass state around in several places, and that can probably be easily avoided by passing context on the stack instead (e.g. passing the upload authorization token directly to FileUploadRequestGenerators.Upload as an argument).

Of course, the simplest approach to start would just to be document that the library is not thread-safe. 😂

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants