From 771e0e221ead5462c6c5e823f98a6a53dff981cc Mon Sep 17 00:00:00 2001 From: Andre Medeiros Date: Mon, 5 Jul 2021 21:55:01 -0400 Subject: [PATCH] don't spam --- cmd/apollo-worker/main.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cmd/apollo-worker/main.go b/cmd/apollo-worker/main.go index e340194..2b657ef 100644 --- a/cmd/apollo-worker/main.go +++ b/cmd/apollo-worker/main.go @@ -103,6 +103,12 @@ func accountWorker(id int, rc *reddit.Client, db *sql.DB, logger *log.Logger, qu log.Fatal(err) } + // If no latest message recorded, we're not going to notify on every message. Remember that and move on. + if account.LastMessageID == "" { + tx.Commit() + continue + } + devices := []string{} query = ` SELECT apns_token FROM devices