Przeglądaj źródła

add debug lines for slack notifs

Alexander Belanger 4 lat temu
rodzic
commit
376261d968
1 zmienionych plików z 11 dodań i 2 usunięć
  1. 11 2
      api/server/handlers/kube_events/create.go

+ 11 - 2
api/server/handlers/kube_events/create.go

@@ -125,19 +125,28 @@ func notifyPodCrashing(
 
 		conf, err = config.Repo.NotificationConfig().CreateNotificationConfig(conf)
 
-		if err == nil {
-			notifConfig = conf.ToNotificationConfigType()
+		if err != nil {
+			fmt.Println("GOT AN ERROR 0", err)
+
+			return err
 		}
+
+		notifConfig = conf.ToNotificationConfigType()
 	} else if err != nil {
+		fmt.Println("GOT AN ERROR 1", err)
+
 		return err
 	} else if err == nil && conf != nil {
 		if !conf.ShouldNotify() {
+			fmt.Println("SHOULD NOTIFY WAS", conf.ShouldNotify())
 			return nil
 		}
 
 		notifConfig = conf.ToNotificationConfigType()
 	}
 
+	fmt.Println("CONF IS", conf, notifConfig, conf.ShouldNotify(), conf.LastNotifiedTime, time.Now().Add(-10*time.Minute))
+
 	slackInts, _ := config.Repo.SlackIntegration().ListSlackIntegrationsByProjectID(project.ID)
 
 	notifier := slack.NewSlackNotifier(notifConfig, slackInts...)