We've run into a condition where a request to refresh a token was replayed which resulted in duplicate requests processed at the same time. The first one succeeded and the second one failed with an Ecto.StaleEntryError when trying to revoke and delete the token. Instead of doing a delete on the Model could we just do a delete by the value of the primary key so we can return an {:error} instead of throwing an error?
Similar to: https://github.com/ueberauth/guardian_db/blob/82fb31f84da639d5a43cf698224458bc14289232/lib/guardian/db/token.ex#L66
We've run into a condition where a request to refresh a token was replayed which resulted in duplicate requests processed at the same time. The first one succeeded and the second one failed with an
Ecto.StaleEntryError
when trying to revoke and delete the token. Instead of doing a delete on the Model could we just do a delete by the value of the primary key so we can return an{:error}
instead of throwing an error?Similar to: https://github.com/ueberauth/guardian_db/blob/82fb31f84da639d5a43cf698224458bc14289232/lib/guardian/db/token.ex#L66