aboutsummaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorredmatrix <redmatrix@redmatrix.me>2015-09-14 20:43:39 -0700
committerredmatrix <redmatrix@redmatrix.me>2015-09-14 20:43:39 -0700
commit021c81cb62210cb33e9cc155a918b7ed5ebc20ac (patch)
treeb810fe0e53ae39537f070770af2bcbe5b64d0f1d /include
parent7099e09a5cb8e2c263890f65f5b3ad01afe88a8e (diff)
downloadvolse-hubzilla-021c81cb62210cb33e9cc155a918b7ed5ebc20ac.tar.gz
volse-hubzilla-021c81cb62210cb33e9cc155a918b7ed5ebc20ac.tar.bz2
volse-hubzilla-021c81cb62210cb33e9cc155a918b7ed5ebc20ac.zip
don't deliver to dead hubs
Diffstat (limited to 'include')
-rw-r--r--include/checksites.php2
-rw-r--r--include/notifier.php43
2 files changed, 18 insertions, 27 deletions
diff --git a/include/checksites.php b/include/checksites.php
index ab91dc768..e14837255 100644
--- a/include/checksites.php
+++ b/include/checksites.php
@@ -25,12 +25,10 @@ function checksites_run($argv, $argc){
if($days < 1)
$days = 30;
-
$r = q("select * from site where site_dead = 0 and site_update < %s - INTERVAL %s $sql_options ",
db_utcnow(), db_quoteinterval($days . ' DAY')
);
-
if(! $r)
return;
diff --git a/include/notifier.php b/include/notifier.php
index 3008a44a2..e16f80ecf 100644
--- a/include/notifier.php
+++ b/include/notifier.php
@@ -512,31 +512,10 @@ function notifier_run($argv, $argc){
// Now we have collected recipients (except for external mentions, FIXME)
// Let's reduce this to a set of hubs.
- logger('notifier: hub choice: ' . intval($relay_to_owner) . ' ' . intval($private) . ' ' . $cmd, LOGGER_DEBUG);
-
- // FIXME: I think we need to remove the private bit or this clause will never execute. Needs more coffee to think it through.
- // We may in fact have to send it to clones in case the one we pick recently died.
-
- 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 * from hubloc
- where hubloc_hash in (" . implode(',',$recipients) . ") order by hubloc_connected desc limit 1");
- }
- else {
- $r = q("select * from hubloc where hubloc_hash in (" . implode(',',$recipients) . ")
- and hubloc_error = 0 and hubloc_deleted = 0");
- }
+ $r = q("select * from hubloc where hubloc_hash in (" . implode(',',$recipients) . ")
+ and hubloc_error = 0 and hubloc_deleted = 0"
+ );
+
if(! $r) {
logger('notifier: no hubs');
@@ -545,6 +524,15 @@ function notifier_run($argv, $argc){
$hubs = $r;
+ $dead_hubs = array();
+
+ $dh = q("select site_url from site where site_dead = 1");
+ if(dh) {
+ foreach($dh as $dead) {
+ $dead_hubs[] = $dead['site_url'];
+ }
+ }
+
/**
* Reduce the hubs to those that are unique. For zot hubs, we need to verify uniqueness by the sitekey, since it may have been
@@ -560,6 +548,11 @@ function notifier_run($argv, $argc){
foreach($hubs as $hub) {
+ if(in_array($hub['hubloc_url'],$dead_hubs)) {
+ logger('skipping dead hub: ' . $hub['hubloc_url'], LOGGER_DEBUG);
+ continue;
+ }
+
if($hub['hubloc_network'] == 'zot') {
if(! in_array($hub['hubloc_sitekey'],$keys)) {
$hublist[] = $hub['hubloc_host'];