summaryrefslogtreecommitdiff
path: root/lib/xmppqueuehandler.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-07-09 11:40:01 -0400
committerEvan Prodromou <evan@controlyourself.ca>2009-07-09 11:40:01 -0400
commit1daad01f362d72e6ed89f415546220016c32404a (patch)
tree5cf8f9f3a5ce138634c1ee9abf85435c7155ec7d /lib/xmppqueuehandler.php
parentd7611009b11c489abbc7c52d51ec859fd9fa5600 (diff)
slightly better timing
Diffstat (limited to 'lib/xmppqueuehandler.php')
-rw-r--r--lib/xmppqueuehandler.php9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/xmppqueuehandler.php b/lib/xmppqueuehandler.php
index 9b1a6989e..cbcfe5e1c 100644
--- a/lib/xmppqueuehandler.php
+++ b/lib/xmppqueuehandler.php
@@ -21,6 +21,8 @@ if (!defined('LACONICA')) { exit(1); }
require_once(INSTALLDIR.'/lib/queuehandler.php');
+define('PING_INTERVAL', 120);
+
/**
* Common superclass for all XMPP-using queue handlers. They all need to
* service their message queues on idle, and forward any incoming messages
@@ -31,6 +33,7 @@ require_once(INSTALLDIR.'/lib/queuehandler.php');
class XmppQueueHandler extends QueueHandler
{
var $pingid = 0;
+ var $lastping = null;
function start()
{
@@ -64,7 +67,11 @@ class XmppQueueHandler extends QueueHandler
if ($this->conn) {
$this->log(LOG_DEBUG, "Servicing the XMPP queue.");
$this->conn->processTime($timeout);
- $this->sendPing();
+ $now = time();
+ if (empty($this->lastping) || $now - $this->lastping > PING_INTERVAL) {
+ $this->sendPing();
+ $this->lastping = $now;
+ }
}
} catch (XMPPHP_Exception $e) {
$this->log(LOG_ERR, "Got an XMPPHP_Exception: " . $e->getMessage());