Modify push notification time

rdn

Well-known member
XenForo reduces the default timeout of the Web Push library from 30 to 10 seconds.
I would like to prevent the 10 seconds delay for some users, is it possible I can lower this down to 3 seconds?
Which file to modify?

Thanks.
 

Steffen

Well-known member
Yes, that should reduce the timeout to 3 seconds. You will probably see more "Push notification failure" server errors in your admin panel after this change because timeouts are now more likely to occur.
 

Steffen

Well-known member
This should do the trick:

Diff:
--- src/XF/Service/PushNotification.php
+++ src/XF/Service/PushNotification.php
@@ -250,6 +250,10 @@ class PushNotification extends AbstractService
                             break;
                     }
                 }
+                else if (isset($result['message']) && strpos($result['message'], 'cURL error 28') === 0)
+                {
+                    // ignore timeout errors
+                }
                 else
                 {
                     \XF::logError("Push notification failure: " . \GuzzleHttp\json_encode($result));
 
  • Love
Reactions: rdn

rdn

Well-known member
I'm not sure though on which line should I add that code :oops:.
Code:
else if (isset($result['message']) && strpos($result['message'], 'cURL error 28') === 0)
                {
                    // ignore timeout errors
                }
 

rdn

Well-known member
You will probably see more "Push notification failure" server errors in your admin panel after this change because timeouts are now more likely to occur.
I even changed it to 2, but still only few errors pop out.

2 seconds max response from google/firefox push servers is fine I think versus long delay for some forum activity like post reply.
 
Top