Skip to content

Commit ec0b11d

Browse files
committed
Retry ping insert if duplicate key error occurs
Affects issues: - Fixed #3915
1 parent bf143e1 commit ec0b11d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

Plan/common/src/main/java/com/djrapitops/plan/exceptions/database/DBOpException.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,6 @@ && getCause() != null
169169

170170
public boolean isDuplicateKeyViolation() {
171171
return context != null
172-
&& context.getRelated().contains(DBOpException.CONSTRAINT_VIOLATION);
172+
&& context.getRelated().contains(DBOpException.DUPLICATE_KEY);
173173
}
174174
}

Plan/common/src/main/java/com/djrapitops/plan/storage/database/transactions/events/PingStoreTransaction.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ protected void performOperations() {
6060
execute(DataStoreQueries.storePing(playerUUID, serverUUID, ping));
6161
} catch (DBOpException failed) {
6262
if (userInsertError != null) failed.addSuppressed(userInsertError);
63-
if (failed.isUserIdConstraintViolation()) {
63+
if (failed.isUserIdConstraintViolation() || failed.isDuplicateKeyViolation()) {
6464
retry(ping, failed);
6565
} else {
6666
throw failed;

0 commit comments

Comments
 (0)