Is celery beat framework in go?

Viewed 25

My situation:
My project receive a crontab task config yaml like this:

name: run_every_10_minutes
crontab: */10 * * * *
function: xxx # my crontab function

and the project recognize this task is to be executed every 10 minutes, submit it to celerybeat, and beat triggers xxx function every 10 minutes.

this is easy way in python celerybeat, and i found go cron framework: cron(github).

but i use go cron framework, I can't scale projects replicas because each project reads cronTab from the datasource, so there are multiple projects trigger at the same time. the code like this:

package main

import (
  "fmt"
  "time"

  "github.com/robfig/cron/v3"
)

func main() {
  c := cron.New()
  crontab = readFromDB() 

  c.AddFunc(crontab, func() { // if scale 2 replicas, each project has this code, so trigger at same time
    fmt.Println("tick every 10 second")
  })

  c.Start()
}

is celerybeat in go?? or how i implement beat by simple way

0 Answers
Related