Last active
November 21, 2020 12:43
-
-
Save hanishi/1e75b405ee6ada6990ad4a627265092a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.... | |
val days = 3 | |
val lastTimestamp = OffsetDateTime | |
.ofInstant( | |
Instant | |
.ofEpochSecond(timestamp), | |
ZoneId.systemDefault() | |
) | |
.truncatedTo(ChronoUnit.DAYS) | |
val nextScheduleTimestamp = lastTimestamp.plusSeconds(days * 24 * 60 * 60) | |
val duration = nextScheduleTimestamp.toEpochSecond - OffsetDateTime | |
.now() | |
.toEpochSecond | |
if (duration > 0) | |
timers.startSingleTimer( | |
SomeTimer, | |
SomeMessage, | |
duration.seconds | |
) | |
else | |
context.self ! SomeMessage | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment