dtc
dtc

Reputation: 1849

django signals: synchronization issues?

When we have multiple users connecting to django, I have signals that play around with each other and disconnect and reconnect. Are they completely separate for each user, even though it's the same server?

So I have two signals A and B both post_save.
Both call each other while disconnecting and reconnecting.

  1. A's signal: Disconnect A,B and do B.save()
  2. B's signal: Disconnect A,B and do A.save()

Are there synchronization issues with django signals? If I save multiple A's and B's all at the same time, are django signals going to handle this okay?

I'm guessing the signals have a different "signature" every time they are called or something.

Upvotes: 0

Views: 330

Answers (1)

Michael C. O'Connor
Michael C. O'Connor

Reputation: 9890

Since signal handlers are normally connected when the module they live in is loaded, and not on each request, the effects of connecting and disconnecting them at run time will all users being handled by the same Django process, and not just an individual request.

Django bug 14533 seems to have addressed some thread safety issues, so this might work if you intended it to have side-effects between requests, but otherwise, you should consider using signals in a more conventional way.

Upvotes: 1

Related Questions