Files
Enes Cakir b73dd78e11 Return expected status code when the cache entry already exists
`GithubCacheEntry` is unique by `[:repository_id, :scope, :key,
:version]`. We check for its existence and return a smoother error
message when the cache entry already exists.

If a customer tries to create a cache entry that already exists at the
same time, a race condition could cause two threads to attempt to create
the same cache entry, resulting in an HTTP 500 error. We see a few
examples of this every day.

We already have a check and a test for the already existing case. But
it's not very robust to catch the database level exception.

`Sequel::ValidationFailed` exception is raised when unique validation
fails at the Sequel model level. `Sequel::UniqueConstraintViolation`
exception is raised when uniqueness validation passes at the Sequel
model level but fails at the database level due to concurrency.
2024-11-05 15:10:21 +03:00
..
2024-11-04 16:34:05 +01:00
2024-11-04 16:34:05 +01:00
2024-11-02 14:42:08 -07:00