As it always happens, 4am Sunday it well went to hell – Django create two instances of ‘2021-08-15’.
Eventually every requests that had this line in it just crashed.
Why did this happen? Well, apparently two instances are not supposed to be made.
My friends and I came to a conclusion that with a very high amount of requests Django missed that tiny bit of time between executing get_or_create method and actually writing an instance to PostgreSQL.
Well good thing - I went to bed late, and my team woke me up much earlier than I would wake up.
What is he solution? If the field is meant to be unique, make it unique:
date = DateField(unique=True)