mirror of
https://github.com/syumai/workers.git
synced 2025-03-10 17:29:11 +00:00
move cron into cloudflare package
This commit is contained in:
parent
e1ef423ff7
commit
d3e1df72ac
@ -1,4 +1,4 @@
|
||||
package workers
|
||||
package cron
|
||||
|
||||
import (
|
||||
"context"
|
@ -5,11 +5,11 @@ import (
|
||||
"errors"
|
||||
"fmt"
|
||||
|
||||
"github.com/syumai/workers"
|
||||
"github.com/syumai/workers/cloudflare"
|
||||
"github.com/syumai/workers/cloudflare/cron"
|
||||
)
|
||||
|
||||
func task(ctx context.Context, event workers.CronEvent) error {
|
||||
func task(ctx context.Context, event cron.CronEvent) error {
|
||||
fmt.Println(cloudflare.Getenv(ctx, "HELLO"))
|
||||
|
||||
if event.ScheduledTime.Minute()%2 == 0 {
|
||||
@ -20,5 +20,5 @@ func task(ctx context.Context, event workers.CronEvent) error {
|
||||
}
|
||||
|
||||
func main() {
|
||||
workers.ScheduleTask(task)
|
||||
cron.ScheduleTask(task)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user