mirror of
https://github.com/jeremyd/ergo.git
synced 2026-07-29 02:08:12 -07:00
fix buggy persistence of push timestamps
getPushSubscriptions() could have a stale view of the latest subscription renewal and successful push times. We don't want to rebuild on every renewal or every push, so add a boolean refresh argument that controls rebuilding.
This commit is contained in:
+1
-1
@@ -311,7 +311,7 @@ func (server *Server) periodicPushMaintenance() {
|
||||
func (server *Server) performPushMaintenance() {
|
||||
expiration := time.Duration(server.Config().WebPush.Expiration)
|
||||
for _, client := range server.clients.AllWithPushSubscriptions() {
|
||||
for _, sub := range client.getPushSubscriptions() {
|
||||
for _, sub := range client.getPushSubscriptions(true) {
|
||||
now := time.Now()
|
||||
// require both periodic successful push messages and renewal of the subscription via WEBPUSH REGISTER
|
||||
if now.Sub(sub.LastSuccess) > expiration || now.Sub(sub.LastRefresh) > expiration {
|
||||
|
||||
Reference in New Issue
Block a user