]> git.mxchange.org Git - friendica.git/commitdiff
try and fix diaspora multiple items queued issue
authorFriendika <info@friendika.com>
Mon, 7 Nov 2011 00:48:13 +0000 (16:48 -0800)
committerFriendika <info@friendika.com>
Mon, 7 Nov 2011 00:48:13 +0000 (16:48 -0800)
boot.php
include/diaspora.php
include/notifier.php

index 76f4f46939ef09f4c603cd7b437164ee15244a98..e46c52a180677ba827ce3f1027d18e77c5e058ac 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -9,7 +9,7 @@ require_once('include/nav.php');
 require_once('include/cache.php');
 
 define ( 'FRIENDIKA_PLATFORM',     'Friendica');
-define ( 'FRIENDIKA_VERSION',      '2.3.1156' );
+define ( 'FRIENDIKA_VERSION',      '2.3.1157' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.22'    );
 define ( 'DB_UPDATE_VERSION',      1102      );
 
index 85be13a30ce65cb75bbbf6140ae4eac50cbc223b..7e1e034d67d5746577f4e20d95d17064ff4f6b0d 100644 (file)
@@ -1728,15 +1728,35 @@ function diaspora_transmit($owner,$contact,$slap,$public_batch) {
 
        $a = get_app();
        $logid = random_string(4);
-       logger('diaspora_transmit: ' . $logid . ' ' . (($public_batch) ? $contact['batch'] : $contact['notify']));
-       post_url((($public_batch) ? $contact['batch'] : $contact['notify']) . '/',$slap);
+       $dest_url = (($public_batch) ? $contact['batch'] : $contact['notify']);
+       if(! $dest_url) {
+               logger('diaspora_transmit: no url for contact: ' . $contact['id'] . ' batch mode =' . $public_batch);
+               return 0;
+       } 
+
+       logger('diaspora_transmit: ' . $logid . ' ' . $dest_url);
+
+       post_url($dest_url . '/', $slap);
+
        $return_code = $a->get_curl_code();
        logger('diaspora_transmit: ' . $logid . ' returns: ' . $return_code);
 
-       if((! $return_code) || (($curl_stat == 503) && (stristr($a->get_curl_headers(),'retry-after')))) {
+       if((! $return_code) || (($return_code == 503) && (stristr($a->get_curl_headers(),'retry-after')))) {
                logger('diaspora_transmit: queue message');
-               // queue message for redelivery
-               add_to_queue($contact['id'],NETWORK_DIASPORA,$slap,$public_batch);
+
+               $r = q("SELECT id from queue where cid = %d and network = '%s' and content = '%s' and batch = %d limit 1",
+                       intval($contact['id']),
+                       dbesc(NETWORK_DIASPORA),
+                       dbesc($slap),
+                       intval($public_batch)
+               );
+               if(count($r)) {
+                       logger('diaspora_transmit: add_to_queue ignored - identical item already in queue');
+               }
+               else {
+                       // queue message for redelivery
+                       add_to_queue($contact['id'],NETWORK_DIASPORA,$slap,$public_batch);
+               }
        }
 
 
index cc53a17c421ff6a86bdbb8205e4306e764c1b83a..a4fe9b71e083c33ac0ab64bfb77a8db15d2a5bd8 100644 (file)
@@ -206,7 +206,7 @@ function notifier_run($argv, $argc){
 
                /**
                 *
-                * Be VERY CAREFUL if you make any changes to the following lines. Seemingly innocuous changes 
+                * Be VERY CAREFUL if you make any changes to the following several lines. Seemingly innocuous changes 
                 * have been known to cause runaway conditions which affected several servers, along with 
                 * permissions issues. 
                 *
@@ -218,6 +218,17 @@ function notifier_run($argv, $argc){
                        $relay_to_owner = true;
                }
 
+               // until the 'origin' flag has been in use for several months
+               // we will just use it as a fallback test
+               // later we will be able to use it as the primary test of whether or not to relay.
+
+               if(! $target_item['origin'])
+                       $relay_to_owner = false;
+
+               if($parent['origin'])
+                       $relay_to_owner = false;
+
+
 
                if($relay_to_owner) {
                        logger('notifier: followup', LOGGER_DEBUG);