changeset 66:629d9ad289fe

doc & refactor
author drewp@bigasterisk.com
date Fri, 06 Sep 2024 17:26:11 -0700
parents 329144c7e711
children 1f84bd5ce8e0
files calsync/notificationrouter/notificationrouter.go
diffstat 1 files changed, 8 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/calsync/notificationrouter/notificationrouter.go	Fri Sep 06 17:25:40 2024 -0700
+++ b/calsync/notificationrouter/notificationrouter.go	Fri Sep 06 17:26:11 2024 -0700
@@ -1,6 +1,8 @@
 package notificationrouter
 
-// Holds the map of (random) watchIds and the sync functions for the affected calendars.
+// Holds the map of (random) watchIds and the sync functions for the affected
+// calendars. When google sends a notification, this object calls the right
+// sync.
 
 import (
 	"log"
@@ -34,12 +36,12 @@
 	watchId := r.Header.Get("X-Goog-Channel-ID")
 	if nr.handlers[watchId] == nil {
 		log.Println("incoming notification for unknown watch id", watchId, "(ignoring)")
-	} else {
-		// todo: The first notification on a given watchId is the confirmation,
-		// and the sync func is probably (surely?) not needed.
-		log.Println("incoming notification for known watch id", watchId)
-		nr.handlers[watchId]()
+		return
 	}
+	// todo: The first notification on a given watchId is the confirmation,
+	// and the sync func is probably (surely?) not needed.
+	log.Println("incoming notification for known watch id", watchId)
+	nr.handlers[watchId]()
 }
 
 func NewWatchId() string {