mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
* fix(eventbridge): wait for the rate timer before delivery * test(eventbridge): drive scheduled SQL account checks from timer Co-authored-by: Andre Kurait <AndreKurait@gmail.com>
This commit is contained in:
1 parent
65c6440b8f
commit
3e7ce122e7
3 files changed
+80
-3
No files matched your search
@@ -102,7 +102,7 @@ public class RuleScheduler implements Resettable {
|
||||
|
||||
long timerId = vertx.setPeriodic(intervalMs, id -> tick(ruleArn, id, dataSupplier));
|
||||
scheduleContexts.put(ruleArn, new ScheduleContext(timerId, scheduleExpr));
|
||||
tick(ruleArn, timerId, dataSupplier);
|
||||
currentScheduleData(ruleArn, timerId, dataSupplier);
|
||||
LOG.debugv("Started rate scheduler for rule {0} with interval {1}ms", ruleArn, intervalMs);
|
||||
}
|
||||
|
||||
@@ -150,7 +150,7 @@ public class RuleScheduler implements Resettable {
|
||||
}
|
||||
}
|
||||
|
||||
private void tick(String ruleArn, long timerId, Supplier<ScheduleData> dataSupplier) {
|
||||
private ScheduleData currentScheduleData(String ruleArn, long timerId, Supplier<ScheduleData> dataSupplier) {
|
||||
ScheduleData data = dataSupplier.get();
|
||||
|
||||
if (data == null || data.rule == null) {
|
||||
@@ -158,6 +158,15 @@ public class RuleScheduler implements Resettable {
|
||||
vertx.cancelTimer(timerId);
|
||||
// A rule recreated under the same ARN may already have its own timer; leave that one.
|
||||
scheduleContexts.computeIfPresent(ruleArn, (arn, ctx) -> ctx.timerId() == timerId ? null : ctx);
|
||||
return null;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
private void tick(String ruleArn, long timerId, Supplier<ScheduleData> dataSupplier) {
|
||||
ScheduleData data = currentScheduleData(ruleArn, timerId, dataSupplier);
|
||||
if (data == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user