[AB-xxx] adding support to use @time inputs for duration and instant command parameters

This commit is contained in:
Sheldan
2026-02-15 22:44:57 +01:00
parent 2f125d0101
commit fa62353aee
7 changed files with 93 additions and 20 deletions

View File

@@ -130,13 +130,14 @@ public class RemindServiceBean implements ReminderService {
if(remindIn.getSeconds() < 60) {
reminder.setJobTriggerKey(null);
log.info("Directly scheduling unremind for reminder {}, because it was below the threshold.", reminder.getId());
long nanos = Math.max(remindIn.toNanos(), Duration.ofSeconds(5).toNanos()); // should be good enough, if its too small, it doesnt find the reminder
instantReminderScheduler.schedule(() -> {
try {
self.executeReminder(reminder.getId());
} catch (Exception exception) {
log.error("Failed to remind immediately.", exception);
}
}, remindIn.toNanos(), TimeUnit.NANOSECONDS);
}, nanos, TimeUnit.NANOSECONDS);
} else {
HashMap<Object, Object> parameters = new HashMap<>();
parameters.put("reminderId", reminder.getId().toString());