Skip to content

Commit

Permalink
jobs: fix deprecated schedule() method implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
angryziber committed Apr 6, 2024
1 parent 886b610 commit ee70bfd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Unreleased
# 1.6.8
* server: ErrorHandler now supports finding of handlers using exception super classes
* jobs: fix deprecated schedule() method implementation

# 1.6.7
* core: Converter can now force initialize type arguments' companion objects
Expand Down
4 changes: 2 additions & 2 deletions jobs/src/JobRunner.kt
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ open class JobRunner(

open fun runOnce(job: Job) = workerPool.submit { runInTransaction(job, UNDISPATCHED) }

@Deprecated("Use version with Duration parameters instead", ReplaceWith("schedule(job, period.milliseconds, delay.milliseconds)"))
open fun schedule(job: Job, delay: Long, period: Long, unit: TimeUnit) = schedule(job, period.milliseconds, delay.milliseconds)
@Deprecated("Use version with Duration parameters instead", ReplaceWith("schedule(job, period.seconds, delay.seconds)"))
open fun schedule(job: Job, delay: Long, period: Long, unit: TimeUnit) = schedule(job, unit.toMillis(period).milliseconds, unit.toMillis(delay).milliseconds)

open fun schedule(job: Job, period: Duration, delay: Duration = period) {
val startAt = LocalDateTime.now().plus(delay.toJavaDuration()).truncatedTo(ChronoUnit.SECONDS)
Expand Down

0 comments on commit ee70bfd

Please sign in to comment.