From 1c17d1b69c2b3db9f9c3ffd0dee4ca9ea57af05a Mon Sep 17 00:00:00 2001 From: friendica Date: Sat, 24 Aug 2013 18:55:07 -0700 Subject: start timestamping hubloc connections so we can eventually remove dead ones --- mod/post.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'mod/post.php') diff --git a/mod/post.php b/mod/post.php index 07f2cd083..847af0fe9 100644 --- a/mod/post.php +++ b/mod/post.php @@ -297,13 +297,23 @@ function post_post(&$a) { // (!!) this will validate the sender $result = zot_register_hub($sender); - if((! $result['success']) || (! zot_gethub($sender))) { + if((! $result['success']) || (! ($hub = zot_gethub($sender)))) { $ret['message'] = 'Hub not available.'; logger('mod_zot: no hub'); json_return_and_die($ret); } } + + // Update our DB to show when we last communicated successfully with this hub + // This will allow us to prune dead hubs from using up resources + + $r = q("update hubloc set hubloc_connected = '%s' where hubloc_id = %d limit 1", + dbesc(datetime_convert()), + intval($hub['hubloc_id']) + ); + + // TODO: check which hub is primary and take action if mismatched if(array_key_exists('recipients',$data)) -- cgit v1.2.3