【文件属性】:
文件名称:jobs:用于 Go 的作业 API
文件大小:9KB
文件格式:ZIP
更新时间:2021-07-02 02:47:55
Go
职位
MongoDB 的作业管理(通过 mgo)。
简单的API
作业保证只运行一次(不管有多少跑步者)
重试
尽快运行作业,或在未来某个日期运行
MongoDB 作为其后端
用法
// create a job and set some data
job := jobs.New("notifications")
job.Data["message"] = "Hello world"
// put the job
jobs.Put(db.C("jobs"), job)
同时,在一个很远很远的过程中:
r := jobs.NewRunner("runner-1", db.C("jobs"), "notifications", func(j *jobs.J) error {
log.Println("TODO: process this message -", j.Data["
【文件预览】:
jobs-master
----runner.go(4KB)
----runner_test.go(7KB)
----status_test.go(1KB)
----jobs.go(1KB)
----example()
--------creator()
--------runner()
----LICENSE(1KB)
----doc.go(74B)
----README.md(711B)
----db.sh(43B)
----jobs_test.go(1KB)
----.gitignore(319B)
----status.go(1KB)