diff --git a/app/services/push_notification_pusher.rb b/app/services/push_notification_pusher.rb index 39155a771a3..a7d562f238f 100644 --- a/app/services/push_notification_pusher.rb +++ b/app/services/push_notification_pusher.rb @@ -1,6 +1,8 @@ require_dependency 'webpush' class PushNotificationPusher + TOKEN_VALID_FOR_SECONDS ||= 5 * 60 + def self.push(user, payload) message = { title: I18n.t( @@ -82,7 +84,8 @@ class PushNotificationPusher vapid: { subject: Discourse.base_url, public_key: SiteSetting.vapid_public_key, - private_key: SiteSetting.vapid_private_key + private_key: SiteSetting.vapid_private_key, + expiration: TOKEN_VALID_FOR_SECONDS } ) rescue Webpush::ExpiredSubscription