-
Notifications
You must be signed in to change notification settings - Fork 150
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Thread safety #77
Comments
could you describe your problem or perhaps even provide code/specs to reproduce it? |
The adapter object is shared globally. If you use HTTPI from multiple threads it won't work. |
we still need a spec to verify a potential fix. i think @rogerleite was planning to work on adapters after his holidays. |
This is obvious from the design. Maybe it would be better to redesign the library somehow, to allow persistent connections etc. and make it thread safe. client = HTTPI.new
client.get
...
client.close One could still provide convenience methods HTTPI.get etc which have the overhead that they always create a new HTTPI instance each time. |
I looked again at your code more carefully - no I am not so confused anymore. The adapter isn't shared as it seemed to me before, so no problem. But I still wonder why do you not have a HTTPI::Client class. Then would could also implement persistent connections. |
because it's simply not that easy to support. see #41 |
Ah ok! Maybe drop the backends which don't support such a design... |
HTTPI doesn't seem to be thread safe because of global state. This is bad :(
Also related to #73
The text was updated successfully, but these errors were encountered: