1
0
mirror of https://github.com/django/django.git synced 2025-01-18 22:33:44 +00:00
django/tests/get_or_create
Simon Charette 6cfe00ee43 Refs #29499 -- Fixed race condition in update_or_create() test.
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().
2025-01-15 15:36:57 +01:00
..