Reputation: 563
short question.
I'm using redis-py to set some keys on my redis server and I'm experiencing some weird behaviour.
I suspect it has something to do with the StrictRedis.pipe.
I have multiple threads pushing commands to the same pipe and after a while I run execute on this pipe and run all of its commands.
I wanted to know if the pipe is thread-safe? can I push commands from multiple threads without any synchronisation mechanism?
Thank you.
Upvotes: 1
Views: 1374
Reputation: 1780
Looks like it is not, according to the documentation:
"It is not safe to pass PubSub or Pipeline objects between threads."
Therefore I assume you either need some sort of synchronisation mechanism. I have to admit I haven't tested any, but if I were to implement one I would try to go with a Multithreaded queue.
There may be a better way to do it, as I am not a python expert.
Hope this helps, though
Upvotes: 1