mirror of
https://github.com/django/django.git
synced 2025-01-18 22:33:44 +00:00
6cfe00ee43
The usage of time.sleep() could result in the update_or_create() thread winning the race to create the row if the backend takes a while to create a new connection in the main thread. Relying on threading.Event ensures that the flow of execution is systematically yield back and forth between the main thread and the thread in charge of performing the background update_or_create().