diff options
author | friendica <info@friendica.com> | 2014-12-17 01:50:43 -0800 |
---|---|---|
committer | friendica <info@friendica.com> | 2014-12-17 01:50:43 -0800 |
commit | eebb6f23fb82c8b81f5c1c8fd6e7210e9275fe35 (patch) | |
tree | 5ab62b4e4a3cf4b554839916fc89744757f89e6c /include/notifier.php | |
parent | f113984d69ec6d5c16efcc67f43e755821a53a8e (diff) | |
download | volse-hubzilla-eebb6f23fb82c8b81f5c1c8fd6e7210e9275fe35.tar.gz volse-hubzilla-eebb6f23fb82c8b81f5c1c8fd6e7210e9275fe35.tar.bz2 volse-hubzilla-eebb6f23fb82c8b81f5c1c8fd6e7210e9275fe35.zip |
critical notifier fix to make diaspora delivery work reliably again. If everything breaks revert or debug.
Diffstat (limited to 'include/notifier.php')
-rw-r--r-- | include/notifier.php | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/include/notifier.php b/include/notifier.php index cb97fcdf8..931732686 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -493,40 +493,33 @@ function notifier_run($argv, $argc){ $r = q("select hubloc_guid, hubloc_url, hubloc_sitekey, hubloc_network, hubloc_flags, hubloc_callback, hubloc_host from hubloc - where hubloc_hash in (" . implode(',',$recipients) . ") group by hubloc_sitekey order by hubloc_connected desc limit 1"); + where hubloc_hash in (" . implode(',',$recipients) . ") order by hubloc_connected desc limit 1"); } else { - if(ACTIVE_DBTYPE == DBTYPE_POSTGRES) { - $r = q("select distinct on (hubloc_sitekey) hubloc_guid, hubloc_url, hubloc_sitekey, hubloc_network, hubloc_flags, hubloc_callback, hubloc_host from hubloc - where hubloc_hash in (" . implode(',',$recipients) . ") and not (hubloc_flags & %d)>0 and not (hubloc_status & %d)>0", - intval(HUBLOC_FLAGS_DELETED), - intval(HUBLOC_OFFLINE) - ); - } else { $r = q("select hubloc_guid, hubloc_url, hubloc_sitekey, hubloc_network, hubloc_flags, hubloc_callback, hubloc_host from hubloc - where hubloc_hash in (" . implode(',',$recipients) . ") and not (hubloc_flags & %d)>0 and not (hubloc_status & %d)>0 group by hubloc_sitekey", + where hubloc_hash in (" . implode(',',$recipients) . ") and not (hubloc_flags & %d) > 0 and not (hubloc_status & %d) > 0", intval(HUBLOC_FLAGS_DELETED), intval(HUBLOC_OFFLINE) - ); - } - } + ); + } if(! $r) { logger('notifier: no hubs'); return; } + $hubs = $r; $hublist = array(); + $dhubs = array(); $keys = array(); foreach($hubs as $hub) { - // don't try to deliver to deleted hublocs - and inexplicably SQL "distinct" and "group by" - // both return records with duplicate keys in rare circumstances -// FIXME this is probably redundant now. - if((! ($hub['hubloc_flags'] & HUBLOC_FLAGS_DELETED)) && (! in_array($hub['hubloc_sitekey'],$keys))) { + if((! $hub['hubloc_sitekey']) || (! in_array($hub['hubloc_sitekey'],$keys))) { $hublist[] = $hub['hubloc_host']; - $keys[] = $hub['hubloc_sitekey']; + $dhubs[] = $hub; + if($hub['hubloc_sitekey']) + $keys[] = $hub['hubloc_sitekey']; } } @@ -542,7 +535,7 @@ function notifier_run($argv, $argc){ $deliver = array(); - foreach($hubs as $hub) { + foreach($dhubs as $hub) { if(defined('DIASPORA_RELIABILITY_EMULATION')) { $cointoss = mt_rand(0,2); |