Skip to content

Commit

Permalink
Retry ping insert if duplicate key error occurs
Browse files Browse the repository at this point in the history
Affects issues:
- Fixed #3915
  • Loading branch information
AuroraLS3 committed Jan 6, 2025
1 parent bf143e1 commit ec0b11d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,6 @@ && getCause() != null

public boolean isDuplicateKeyViolation() {
return context != null
&& context.getRelated().contains(DBOpException.CONSTRAINT_VIOLATION);
&& context.getRelated().contains(DBOpException.DUPLICATE_KEY);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ protected void performOperations() {
execute(DataStoreQueries.storePing(playerUUID, serverUUID, ping));
} catch (DBOpException failed) {
if (userInsertError != null) failed.addSuppressed(userInsertError);
if (failed.isUserIdConstraintViolation()) {
if (failed.isUserIdConstraintViolation() || failed.isDuplicateKeyViolation()) {
retry(ping, failed);
} else {
throw failed;
Expand Down

0 comments on commit ec0b11d

Please sign in to comment.