Skip to content

Commit

Permalink
Code: Added failsafe for endless outbid update loop on error
Browse files Browse the repository at this point in the history
  • Loading branch information
GoldenGnu committed Sep 23, 2023
1 parent 732baf2 commit 1800c25
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -559,14 +559,21 @@ private void updateESI() {
JOptionPane.showMessageDialog(program.getMainWindow().getFrame(), TabsOrders.get().updateNoActiveMsg(), TabsOrders.get().updateNoActiveTitle(), JOptionPane.PLAIN_MESSAGE);
return;
}
final Date currentUpdate = Settings.get().getPublicMarketOrdersNextUpdate();
OutbidProcesserOutput output = new OutbidProcesserOutput();
final PublicMarkerOrdersUpdateTask updateTask = new PublicMarkerOrdersUpdateTask(input, output);
TaskDialog taskDialog = new TaskDialog(program, updateTask, false, jAutoUpdate.isSelected(), jAutoUpdate.isSelected(), StatusPanel.UpdateType.PUBLIC_MARKET_ORDERS, new TaskDialog.TasksCompletedAdvanced() {
@Override
public void tasksCompleted(TaskDialog taskDialog) {
//Set data
Settings.lock("Outbid (ESI)");
Settings.get().setMarketOrdersOutbid(output.getOutbids());
Settings.unlock("Outbid (ESI)");
//Ensure we don't update repeatedly on errors
if (Settings.get().getPublicMarketOrdersNextUpdate().equals(currentUpdate)) {
//if next update did not change, set the next update to be 5 minutes in the future
Settings.get().setPublicMarketOrdersNextUpdate(new Date(System.currentTimeMillis() + (1000 * 60 * 5)));
}
//Update eventlists
if (!output.getOutbids().isEmpty() || !output.getUpdates().isEmpty()) {
LOG.info("Updating Orders EventList");
Expand Down

0 comments on commit 1800c25

Please sign in to comment.