Ensure donations jobs will always run on the same single threaded scheduler.

Bump version to 2.9.2.
This commit is contained in:
Thijs Alders committed 2024-04-16 23:45:46 +02:00
1 parent 8108b06f59
commit 78bf4f9301
4 files changed
+22 -4

No files matched your search

@@ -141,4 +141,8 @@ public class CraftingStore {
public Map<Integer, Donation> getPendingDonations() {
return pendingDonations;
}
public DonationRunner getDonationRunner() {
return donationRunner;
}
}
@@ -43,4 +43,8 @@ public class DonationRunner {
}
});
}
public ExecutorService getExecutor() {
return executor;
}
}
@@ -23,8 +23,8 @@ public class DonationChecker implements Runnable {
return;
}
if (instance.getProviderSelector().isConnected()) {
// Only run this runnable every 25 minutes when we are connected to a websocket.
long target = System.currentTimeMillis() - (25 * 60 * 1000);
// Only run this runnable every 30 minutes when we are connected to a websocket.
long target = System.currentTimeMillis() - (30 * 60 * 1000);
if (lastRun > target) {
return;
}
@@ -37,7 +37,17 @@ public class DonationChecker implements Runnable {
for (int i = 0; i < chunked.length; i++) {
Donation[] chunk = chunked[i];
this.instance.getLogger().debug(String.format("Creating ExecuteDonationsJob for chunk %d/%d", i + 1, chunked.length));
new ExecuteDonationsJob(instance, chunk);
this.instance.getDonationRunner().getExecutor().submit(() -> {
try {
new ExecuteDonationsJob(instance, chunk);
} catch (CraftingStoreApiException e) {
if (instance.getLogger().isDebugging()) {
e.printStackTrace();
} else {
instance.getLogger().error("Failed to execute donation. If this issue persists, please contact support at https://craftingstore.net.");
}
}
});
}
} catch (CraftingStoreApiException | InterruptedException | ExecutionException e) {
if (instance.getLogger().isDebugging()) {
+1 -1
View File
@@ -11,7 +11,7 @@
<properties>
<revision>${craftingstore-version}-RELEASE</revision>
<craftingstore-version>2.9.1</craftingstore-version>
<craftingstore-version>2.9.2</craftingstore-version>
</properties>
<build>