deltachat / notifiers

Notify devices
Apache License 2.0
6 stars 0 forks source link

fix: remove device tokens on any errors #13

Closed link2xt closed 8 months ago

link2xt commented 8 months ago

410 case seems to be dead code because 410 errors are actually returned as Err case, not Ok.

There are also errors 400 according to the log.

Fixes #12

link2xt commented 8 months ago

I have deployed it now and it started removing tokens for various reasons ("Unregistered", "DeviceTokenNotForTopic") etc. We currently have more than 16400 devices "registered", it takes forever to deliver notifications:

Feb 19 01:36:56 page notifiers[155882]: {"level":30,"time":1708306616463,"msg":"sending notifications to 16393 devices"}
Feb 19 02:41:03 page notifiers[155882]: {"level":30,"time":1708310463541,"msg":"sending notifications to 16394 devices"}
Feb 19 03:17:10 page notifiers[163950]: {"level":30,"time":1708312630854,"msg":"sending notifications to 16394 devices"}
Feb 19 04:31:01 page notifiers[163950]: {"level":30,"time":1708317061976,"msg":"sending notifications to 16394 devices"}
Feb 19 05:27:36 page notifiers[163950]: {"level":30,"time":1708320456560,"msg":"sending notifications to 16394 devices"}
Feb 19 06:29:58 page notifiers[163950]: {"level":30,"time":1708324198687,"msg":"sending notifications to 16394 devices"}

(see the interval between log messages)

It is supposed to send notifications every 20 minutes, but sending to all devices already takes about one hour. Let's see how it goes once we actually prune broken tokens.