Skip to content

Commit

Permalink
fix(error-apps): reset apps in error state (#19052)
Browse files Browse the repository at this point in the history
  • Loading branch information
sushi30 authored Dec 19, 2024
1 parent efbdf21 commit 6fab88a
Showing 1 changed file with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import org.quartz.TriggerBuilder;
import org.quartz.TriggerKey;
import org.quartz.impl.StdSchedulerFactory;
import org.quartz.impl.matchers.GroupMatcher;

@Slf4j
public class AppScheduler {
Expand Down Expand Up @@ -93,10 +94,32 @@ private AppScheduler(
.getListenerManager()
.addJobListener(new OmAppJobListener(dao), jobGroupEquals(APPS_JOB_GROUP));

this.resetErrorTriggers();

// Start Scheduler
this.scheduler.start();
}

private void resetErrorTriggers() {
try {
scheduler
.getTriggerKeys(GroupMatcher.anyGroup())
.forEach(
triggerKey -> {
try {
if (scheduler.getTriggerState(triggerKey) == Trigger.TriggerState.ERROR) {
LOG.info("Resetting trigger {} from error state", triggerKey);
scheduler.resetTriggerFromErrorState(triggerKey);
}
} catch (SchedulerException e) {
throw new RuntimeException(e);
}
});
} catch (SchedulerException ex) {
LOG.error("Failed to reset failed triggers", ex);
}
}

public static void initialize(
OpenMetadataApplicationConfig config, CollectionDAO dao, SearchRepository searchClient)
throws SchedulerException {
Expand Down

0 comments on commit 6fab88a

Please sign in to comment.