0

I have a simple tornado/redis chat that has a pool with listeners(simple dict with username as key and websocket object as value) so one(let's say moderator) could modify users websocket objects to e.g. ban someone. But when I launched multiple IOLoop instances, I suddenly realized that this pool isn't global anymore. So the question is, is it possible to have something like shared variable between all IOLoops? I have tried to make this pool a part of Application before forking IOLoop like this:

app = Application()
app.listeners = {}
http_server = HTTPServer(app)
http_server.bind(8181)
http_server.start(0)

But it didn't work.

Kotakon
  • 15
  • 1
  • 5

1 Answers1

0

To share data among distinct Python processes, the data must be stored in some central process like the database server. I suggest putting your shared data in Redis, since you're already using it.

A. Jesse Jiryu Davis
  • 23,641
  • 4
  • 57
  • 70