From 9498ed17ab4d71d926c47d02f4c9ae2f97e1a1d1 Mon Sep 17 00:00:00 2001 From: friendica Date: Tue, 11 Feb 2014 14:35:02 -0800 Subject: move expiration of notifications to the equivalent of "cron daily" to try and reduce the number of things the poller has to do on every run. --- include/poller.php | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) (limited to 'include/poller.php') diff --git a/include/poller.php b/include/poller.php index f75ba2f22..ce9b75eb3 100644 --- a/include/poller.php +++ b/include/poller.php @@ -47,6 +47,8 @@ function poller_run($argv, $argc){ q("delete from mail where expires != '0000-00-00 00:00:00' and expires < UTC_TIMESTAMP() "); + // expire any expired items + $r = q("select id from item where expires != '0000-00-00 00:00:00' and expires < UTC_TIMESTAMP() and not ( item_restrict & %d ) ", intval(ITEM_DELETED) @@ -57,9 +59,6 @@ function poller_run($argv, $argc){ drop_item($rr['id'],false); } - // expire any read notifications over a month old - - q("delete from notify where seen = 1 and date < UTC_TIMESTAMP() - INTERVAL 30 DAY"); // Ensure that every channel pings a directory server once a month. This way we can discover // channels and sites that quietly vanished and prevent the directory from accumulating stale @@ -107,8 +106,16 @@ function poller_run($argv, $argc){ $dirmode = get_config('system','directory_mode'); + + // Actions in the following block are executed once per day, not on every poller run + if($d2 != intval($d1)) { + // expire any read notifications over a month old + + q("delete from notify where seen = 1 and date < UTC_TIMESTAMP() - INTERVAL 30 DAY"); + + // If this is a directory server, request a sync with an upstream // directory at least once a day, up to once every poll interval. // Pull remote changes and push local changes. @@ -119,14 +126,8 @@ function poller_run($argv, $argc){ sync_directories($dirmode); } - set_config('system','last_expire_day',$d2); -// Uncomment when expire protocol component is working -// Update - this is not going to happen. We are only going to -// implement per-item expire, not blanket expiration -// proc_run('php','include/expire.php'); - proc_run('php','include/cli_suggest.php'); } -- cgit v1.2.3