Stale read on classification creation
Sentry Issue: ARKINDEX-BACKEND-53
UniqueViolation: duplicate key value violates unique constraint "classification_unique_worker_version"
DETAIL: Key (element_id, ml_class_id, worker_version_id)=(f4ef1659-139f-4941-9fa5-c390b5c70c04, 5695f404-4a3d-42f9-8aef-b2f88e046ffb, 7c417675-81e4-4d6d-aebc-881d9160236e) already exists.
File "django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
IntegrityError: duplicate key value violates unique constraint "classification_unique_worker_version"
DETAIL: Key (element_id, ml_class_id, worker_version_id)=(f4ef1659-139f-4941-9fa5-c390b5c70c04, 5695f404-4a3d-42f9-8aef-b2f88e046ffb, 7c417675-81e4-4d6d-aebc-881d9160236e) already exists.
(22 additional frame(s) were not displayed)
...
File "django/db/backends/utils.py", line 66, in execute
return self._execute_with_wrappers(sql, params, many=False, executor=self._execute)
File "django/db/backends/utils.py", line 75, in _execute_with_wrappers
return executor(sql, params, many, context)
File "django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
File "django/db/utils.py", line 90, in __exit__
raise dj_exc_value.with_traceback(traceback) from exc_value
File "django/db/backends/utils.py", line 84, in _execute
return self.cursor.execute(sql, params)
Running CreateClassification
twice with the same ML class on the same element with the same source or worker version can cause a HTTP 500 due to a stale read.