return err
}
- if err := c.Subscribe(ctx, "activities"); err != nil {
- return fmt.Errorf("c.Subscribe() = %v", err)
- }
-
- if err := c.Subscribe(ctx, "sleep"); err != nil {
- return fmt.Errorf("c.Subscribe() = %v", err)
+ for _, collection := range []string{"activities", "sleep"} {
+ if err := c.Subscribe(ctx, collection); err != nil {
+ return fmt.Errorf("c.Subscribe(%q) = %v", collection, err)
+ }
+ log.Infof(ctx, "Successfully subscribed to %q", collection)
}
redirectURL := r.URL