Is this library thread-safe?
inikolaev opened this issue · 3 comments
I couldn't find any information on whether BraintreeGateway
is thread-safe or not - could you help me out with that?
👋 @inikolaev to our knowledge we're not doing any operations with shared memory or managing threads. Can you elaborate on your setup? We're curious why you need to confirm this.
👋 @inikolaev to our knowledge we're not doing any operations with shared memory or managing threads. Can you elaborate on your setup? We're curious why you need to confirm this.
Sure! We use FastAPI with asyncio, but since this library doesn't yet support asyncio we need to use it from within a thread pools as to not block event loop. I'm trying to understand whether we should create a thread local instance or we could safely use a single instances from multiple threads.
Didn't want to run into any issues, thus decided to ask first to make sure :)
Sorry that we dropped off on continuing this conversation! I spent some time groking thread safe operations within python, and to my knowledge this library should be safe. We are not using any thread pools in the library.
That said, if anyone does discover an issue within this library that impact thread safety, please open an issue and give us steps to reproduce so we can investigate more deeply.