aboutsummaryrefslogtreecommitdiffstats
path: root/include/diaspora.php
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2011-11-06 16:48:13 -0800
committerFriendika <info@friendika.com>2011-11-06 16:48:13 -0800
commit327105a4ea722e746cae0caa2731ec13435fadc7 (patch)
tree07013dc110bde81cf6e6dc06a1ff9685efe434d4 /include/diaspora.php
parentc991a1a606978bd593fefc6efe244849f6068255 (diff)
downloadvolse-hubzilla-327105a4ea722e746cae0caa2731ec13435fadc7.tar.gz
volse-hubzilla-327105a4ea722e746cae0caa2731ec13435fadc7.tar.bz2
volse-hubzilla-327105a4ea722e746cae0caa2731ec13435fadc7.zip
try and fix diaspora multiple items queued issue
Diffstat (limited to 'include/diaspora.php')
-rw-r--r--include/diaspora.php30
1 files changed, 25 insertions, 5 deletions
diff --git a/include/diaspora.php b/include/diaspora.php
index 85be13a30..7e1e034d6 100644
--- a/include/diaspora.php
+++ b/include/diaspora.php
@@ -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);
+ }
}