this post was submitted on 23 Jun 2025
12 points (100.0% liked)

Golang

2482 readers
2 users here now

This is a community dedicated to the go programming language.

Useful Links:

Rules:

founded 2 years ago
MODERATORS
 

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

you are viewing a single comment's thread
view the rest of the comments
[–] Feyd@programming.dev 2 points 1 week ago (7 children)

This has worked well for me before, on a small scale https://github.com/robfig/cron

[–] lena 2 points 1 week ago (1 children)

correct me if I'm wrong, but it seems like this wouldn't scale well

[–] Feyd@programming.dev 2 points 1 week ago (1 children)

In what way? You haven't provided any information about scaling requirements

[–] lena 1 points 1 week ago (1 children)

I would have to store the users' cron jobs in a database, and then run some kind of loop on startup to start the cron jobs.

[–] Feyd@programming.dev 1 points 1 week ago (1 children)

That is accurate, though it doesn't say anything about scaling requirements

[–] lena 1 points 1 week ago (1 children)

Oops, missed that part. Ideally, this would be able to handle thousands of users

[–] Feyd@programming.dev 1 points 1 week ago

Thousands is nothing, so having a single service holding the info on memory shouldn't be a problem

load more comments (5 replies)