Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix postgres dialect delete expired #367

Merged
merged 3 commits into from
Dec 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
public class DefaultPersistor implements Persistor, Validatable {

private static final String ALL_FIELDS =
"id, uniqueRequestId, invocation, lastAttemptTime, nextAttemptTime, attempts, blocked, processed, version";
"id, uniqueRequestId, invocation, lastAttemptTime, nextAttemptTime, attempts, blocked, processed, version";

/**
* @param writeLockTimeoutSeconds How many seconds to wait before timing out on obtaining a write
Expand Down Expand Up @@ -75,7 +75,7 @@ public class DefaultPersistor implements Persistor, Validatable {
@SuppressWarnings("JavaDoc")
@Builder.Default
private final InvocationSerializer serializer =
InvocationSerializer.createDefaultJsonSerializer();
InvocationSerializer.createDefaultJsonSerializer();

@Override
public void validate(Validator validator) {
Expand Down Expand Up @@ -252,7 +252,7 @@ public List<TransactionOutboxEntry> selectBatch(Transaction tx, int batchSize, I

@Override
public int deleteProcessedAndExpired(Transaction tx, int batchSize, Instant now)
throws Exception {
throws Exception {
try (PreparedStatement stmt =
tx.connection()
.prepareStatement(dialect.getDeleteExpired().replace("{{table}}", tableName))) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public enum Dialect {
MY_SQL_8(true, Constants.DEFAULT_DELETE_EXPIRED_STMT),
POSTGRESQL_9(
true,
"DELETE FROM {{table}} WHERE ctid IN (SELECT ctid FROM {{table}} WHERE nextAttemptTime < ? AND processed = true AND blocked = false LIMIT ?)"),
"DELETE FROM {{table}} WHERE id IN (SELECT id FROM {{table}} WHERE nextAttemptTime < ? AND processed = true AND blocked = false LIMIT ?)"),
H2(false, Constants.DEFAULT_DELETE_EXPIRED_STMT);

/**
Expand Down