Best approach to implement cron-like tasks #7764
Unanswered
fernanluyano
asked this question in
Q&A
Replies: 1 comment
-
In the boot sequence of your app, you can do something like this: object MyApp extends zio.ZIOAppDefault {
val myRecurringProcess: ZIO[...] = ...
val mySchedule = Schedule.forever && Schedule.spaced(1.second)
override def run: ZIO[Environment & ZIOAppArgs & Scope, Any, Any] =
for {
...
_ <- myRecurringProcess.schedule(mySchedule)
...
} yield ...
} See also |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What's a good approach to run functions/tasks in a cron-like manner? Potentially long-term schedules that live through the life-cycle of the application
Beta Was this translation helpful? Give feedback.
All reactions