mirror of
https://github.com/syumai/workers.git
synced 2025-03-11 09:49:12 +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 (
|
import (
|
||||||
"context"
|
"context"
|
@ -5,11 +5,11 @@ import (
|
|||||||
"errors"
|
"errors"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/syumai/workers"
|
|
||||||
"github.com/syumai/workers/cloudflare"
|
"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"))
|
fmt.Println(cloudflare.Getenv(ctx, "HELLO"))
|
||||||
|
|
||||||
if event.ScheduledTime.Minute()%2 == 0 {
|
if event.ScheduledTime.Minute()%2 == 0 {
|
||||||
@ -20,5 +20,5 @@ func task(ctx context.Context, event workers.CronEvent) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
workers.ScheduleTask(task)
|
cron.ScheduleTask(task)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user