openwisp/openwisp-notifications

[bug] Organization.DoesNotExist openwisp_notifications.tasks.ns_organization_created

nemesifier opened this issue · 0 comments

When creating a new org in a prod system this exception pops up.

I think it's because we have to use transaction.on_commit on the handler as we use for the other receivers, otherwise the celery task is spawned before the transaction is saved to the DB and the organization does not exist yet.

Keep in mind that when doing this, some tests may fail because transactions are not enabled in TestCase, for that reason the on_commit may not be triggered, for that reason some tests run in TransactionTestCase