diff options
author | Michael Meer <michael@meer.name> | 2014-01-23 08:50:27 +0100 |
---|---|---|
committer | Michael Meer <michael@meer.name> | 2014-01-23 08:50:27 +0100 |
commit | aec78b32840e09b4a212ca075f97f9fa8d03d90e (patch) | |
tree | be3dbad9a5eba8e92643548600e5c58deb33f033 /include/notifier.php | |
parent | 6a1e73e610350bf3e19354e182803329f1234a8e (diff) | |
parent | bc98f4ddf4cdfa655385c705d97fa006ada9c49f (diff) | |
download | volse-hubzilla-aec78b32840e09b4a212ca075f97f9fa8d03d90e.tar.gz volse-hubzilla-aec78b32840e09b4a212ca075f97f9fa8d03d90e.tar.bz2 volse-hubzilla-aec78b32840e09b4a212ca075f97f9fa8d03d90e.zip |
Merge branch 'master' of https://github.com/friendica/red
to be in sync with main repro
Diffstat (limited to 'include/notifier.php')
-rw-r--r-- | include/notifier.php | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/include/notifier.php b/include/notifier.php index 0868ac77e..81f971107 100644 --- a/include/notifier.php +++ b/include/notifier.php @@ -425,8 +425,28 @@ function notifier_run($argv, $argc){ $sql_extra = (($private) ? "" : " or hubloc_url = '" . dbesc(z_root()) . "' "); - $r = q("select hubloc_sitekey, hubloc_flags, hubloc_callback, hubloc_host from hubloc - where hubloc_hash in (" . implode(',',$recipients) . ") $sql_extra group by hubloc_sitekey"); + + if($relay_to_owner && (! $private) && ($cmd !== 'relay')) { + + // If sending a followup to the post owner, only send it to one channel clone - to avoid race conditions. + // In this case we'll pick the most recently contacted hub, as their primary might be down and the most + // recently contacted has the best chance of being alive. + + // For private posts or uplinks we have to do things differently as only the sending clone will have the recipient list. + // We have to send to all clone channels of the owner to find out who has the definitive list. Posts with + // item_private set (but no ACL list) will return empty recipients (except for the sender and owner) in + // collect_recipients() above. The end result is we should get only one delivery per delivery chain if we + // aren't the owner or author. + + + $r = q("select hubloc_sitekey, 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"); + } + else { + $r = q("select hubloc_sitekey, hubloc_flags, hubloc_callback, hubloc_host from hubloc + where hubloc_hash in (" . implode(',',$recipients) . ") $sql_extra group by hubloc_sitekey"); + } + if(! $r) { logger('notifier: no hubs'); return; |