From 189a31e6287781e03a874b13e27dedefe2beedf3 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 7 May 2012 15:54:49 -0700 Subject: If a contact has had delivery issues in the last 15 minutes, send new posts straight to the queue and don't even try to connect. Also defer polling for stuck contacts. Should reduce the number of stuck processes trying to connect with dead or dying servers significantly. --- include/queue_fn.php | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'include/queue_fn.php') diff --git a/include/queue_fn.php b/include/queue_fn.php index 3c1087f4e..613571c84 100644 --- a/include/queue_fn.php +++ b/include/queue_fn.php @@ -15,6 +15,15 @@ function remove_queue_item($id) { ); } +function was_recently_delayed($cid) { + + $r = q("SELECT `id` FROM `queue` WHERE `cid` = %d + and last > UTC_TIMESTAMP() - interval 15 minute limit 1", + intval($cid) + ); + +} + function add_to_queue($cid,$network,$msg,$batch = false) { -- cgit v1.2.3 From f0b7a8ae35c67f2440c3c3574451f52e5126fa68 Mon Sep 17 00:00:00 2001 From: friendica Date: Mon, 7 May 2012 18:36:28 -0700 Subject: finished dry run - now for real test --- include/queue_fn.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'include/queue_fn.php') diff --git a/include/queue_fn.php b/include/queue_fn.php index 613571c84..2aca338f5 100644 --- a/include/queue_fn.php +++ b/include/queue_fn.php @@ -21,7 +21,9 @@ function was_recently_delayed($cid) { and last > UTC_TIMESTAMP() - interval 15 minute limit 1", intval($cid) ); - + if(count($r)) + return true; + return false; } -- cgit v1.2.3