pennant icon indicating copy to clipboard operation
pennant copied to clipboard

Database driver could support high frequency requests

Open potsky opened this issue 9 months ago • 1 comments

Database driver does not work at scale, we have thousand of SQLSTATE[23505]: Unique violation: 7 ERROR: duplicate key value violates unique constraint "features_name_scope_unique" because of the driver architecture when you have thousand requests per seconds.

As advised by @timacdonald in https://github.com/laravel/pennant/pull/77, we could use an upsert instead of an insert.

Perhaps aninsert in a try catch (UniqueConstraintViolationException) should do the job because it is not really important to update the record several times in a single request...

potsky avatar May 06 '24 07:05 potsky