comparison calsync/main.go @ 80:e8164bd2f9a1

hoist startupJitter to main
author drewp@bigasterisk.com
date Fri, 06 Sep 2024 18:25:32 -0700
parents 329144c7e711
children 0f0b15d8062c
comparison
equal deleted inserted replaced
79:30ad34850ef1 80:e8164bd2f9a1
26 "bigasterisk.com/go/gcalendarwatch/mongoclient" 26 "bigasterisk.com/go/gcalendarwatch/mongoclient"
27 "bigasterisk.com/go/gcalendarwatch/notificationrouter" 27 "bigasterisk.com/go/gcalendarwatch/notificationrouter"
28 "github.com/gorilla/mux" 28 "github.com/gorilla/mux"
29 ) 29 )
30 30
31 const startupJitter = 0 * time.Second
32
31 func main() { 33 func main() {
32 startLogging() 34 startLogging()
33 ctx := context.Background() 35 ctx := context.Background()
34 36
35 gc, err := gcalclient.New(ctx) 37 gc, err := gcalclient.New(ctx)
53 log.Fatal(err) 55 log.Fatal(err)
54 } 56 }
55 57
56 initialSyncBack := (7 * 24) * time.Hour 58 initialSyncBack := (7 * 24) * time.Hour
57 initialSyncAhead := (14 * 24) * time.Hour 59 initialSyncAhead := (14 * 24) * time.Hour
58 err = updateMongoEventsToMatchGoogleForever(mc, gc, initialSyncBack, initialSyncAhead, notifications) 60 err = updateMongoEventsToMatchGoogleForever(mc, gc, initialSyncBack, initialSyncAhead, notifications, startupJitter)
59 if err != nil { 61 if err != nil {
60 log.Fatal(err) 62 log.Fatal(err)
61 } 63 }
62 64
63 r := mux.NewRouter() 65 r := mux.NewRouter()