Ensure donations jobs will always run on the same single threaded scheduler.
Bump version to 2.9.2.
This commit is contained in:
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()) {
|
||||
|
||||
Reference in new issue
Block a user