From a261c3d60a289993100e18735132e70e5465c724 Mon Sep 17 00:00:00 2001 From: Martin Sulikowski Date: Tue, 27 Jan 2026 22:48:41 +0100 Subject: [PATCH 1/2] GH-1283 Fix ignore to await db save and cache refresh --- .../ignore/IgnoreRepositoryOrmLite.java | 28 +++++++++++-------- 1 file changed, 16 insertions(+), 12 deletions(-) diff --git a/eternalcore-core/src/main/java/com/eternalcode/core/feature/ignore/IgnoreRepositoryOrmLite.java b/eternalcore-core/src/main/java/com/eternalcode/core/feature/ignore/IgnoreRepositoryOrmLite.java index ebbb8fbcb..ee9a65260 100644 --- a/eternalcore-core/src/main/java/com/eternalcode/core/feature/ignore/IgnoreRepositoryOrmLite.java +++ b/eternalcore-core/src/main/java/com/eternalcode/core/feature/ignore/IgnoreRepositoryOrmLite.java @@ -57,19 +57,23 @@ public CompletableFuture isIgnored(UUID by, UUID target) { @Override public CompletableFuture ignore(UUID by, UUID target) { - return CompletableFuture.runAsync(() -> { - try { - Set uuids = this.ignores.get(by); - - if (!uuids.contains(target)) { - this.save(IgnoreTable.class, new IgnoreTable(by, target)) - .thenRun(() -> this.ignores.refresh(by)); + return CompletableFuture.supplyAsync(() -> { + try { + return this.ignores.get(by); } - } - catch (ExecutionException exception) { - throw new RuntimeException(exception); - } - }); + catch (ExecutionException exception) { + throw new RuntimeException(exception); + } + }) + .thenCompose(uuids -> { + if (uuids.contains(target)) { + return CompletableFuture.completedFuture(null); + } + + return this.save(IgnoreTable.class, new IgnoreTable(by, target)) + .thenRun(() -> this.ignores.refresh(by)) + .thenApply(unused -> null); + }); } @Override From cddba283e54c9f89c25f02ef94205b157e448bcf Mon Sep 17 00:00:00 2001 From: Martin Sulikowski Date: Tue, 27 Jan 2026 22:58:07 +0100 Subject: [PATCH 2/2] Fix cache refresh not awaiting after saving ignore entry --- .../core/feature/ignore/IgnoreRepositoryOrmLite.java | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/eternalcore-core/src/main/java/com/eternalcode/core/feature/ignore/IgnoreRepositoryOrmLite.java b/eternalcore-core/src/main/java/com/eternalcode/core/feature/ignore/IgnoreRepositoryOrmLite.java index ee9a65260..cf3f07685 100644 --- a/eternalcore-core/src/main/java/com/eternalcode/core/feature/ignore/IgnoreRepositoryOrmLite.java +++ b/eternalcore-core/src/main/java/com/eternalcode/core/feature/ignore/IgnoreRepositoryOrmLite.java @@ -71,8 +71,7 @@ public CompletableFuture ignore(UUID by, UUID target) { } return this.save(IgnoreTable.class, new IgnoreTable(by, target)) - .thenRun(() -> this.ignores.refresh(by)) - .thenApply(unused -> null); + .thenRun(() -> this.ignores.refresh(by)); }); }