This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

feat: add dry mode

+14
+4
churros.go
··· 48 48 } 49 49 50 50 func (msg Message) CreateInDatabaseNotifications(groupId string, subs []Subscription) { 51 + if config.DryRunMode { 52 + ll.Warn("dry run mode enabled, not creating notifications in database") 53 + return 54 + } 51 55 // Create sequentially: this is not something that has to be done fast, and parallelizing would swamp the database connections 52 56 for _, sub := range subs { 53 57 prisma.Notification.CreateOne(
+1
config.go
··· 22 22 StartupScheduleRestoration string `env:"STARTUP_SCHEDULE_RESTORATION" envDefault:"enabled"` 23 23 AppPackageId string `env:"APP_PACKAGE_ID" envDefault:"app.churros"` 24 24 HealthCheckPort int `env:"HEALTH_CHECK_PORT" envDefault:"8080"` 25 + DryRunMode bool `env:"DRY_RUN" envDefault:"false"` 25 26 } 26 27 27 28 func LoadConfiguration() (Configuration, error) {
+4
firebase.go
··· 44 44 return 45 45 } 46 46 message.Tokens = tokens 47 + if config.DryRunMode { 48 + ll.Warn("dry run mode enabled, not sending FCM message to %d tokens", len(tokens)) 49 + return 50 + } 47 51 resp, err := fcm.SendEachForMulticast(firebaseCtx, &message) 48 52 if err != nil { 49 53 ll.ErrorDisplay("while sending FCM message", err)
+5
webpush.go
··· 76 76 wg.Add(len(subs)) 77 77 for _, sub := range subs { 78 78 go func(wg *sync.WaitGroup, sub Subscription) { 79 + if config.DryRunMode { 80 + ll.Warn("dry run mode enabled, not sending webpush notification to %s", sub.Owner.Uid) 81 + wg.Done() 82 + return 83 + } 79 84 resp, err := webpush.SendNotification(jsoned, &sub.Webpush, &webpush.Options{ 80 85 TTL: 30, 81 86 Subscriber: config.ContactEmail,