Cross-posted from “How could I allow users to schedule sending emails at a specific interval?” by @lena@gregtech.eu in !learn_programming@programming.dev


Basically, I’m trying to figure out how I could allow a user to send a schedule in the cron syntax to some API, store it into the database and then send an email to them at that interval. The code is at gragorther/epigo. I’d use go-mail to send the mails.

I found stuff like River or Asynq to schedule tasks, but that is quite complex and I have absolutely no idea what the best way to implement it would be, so help with that is appreciated <3

  • Jack@slrpnk.net
    link
    fedilink
    arrow-up
    2
    ·
    edit-2
    27 days ago

    Depending of how complicated you want it to be of course.

    I would implement it by using the basic goroutines, a wait group to keep track of the goroutines and sleep for the recurring duration.

    Maybe a more optimal solution would be to use a workerpool.

    Also what amount of emails are we talking about and what kind of recurring duration(1/hour or 1/year)