aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Daemon
diff options
context:
space:
mode:
authorMario <mario@mariovavti.com>2021-12-22 09:50:50 +0000
committerMario <mario@mariovavti.com>2021-12-22 09:50:50 +0000
commit27ebeffad41e39dda80159bc27605f5f247174c9 (patch)
tree7da422007d15240c83bc57a60c2e953ac888eab0 /Zotlabs/Daemon
parent07110cee170970b840bbb479e9271a12b4810137 (diff)
downloadvolse-hubzilla-27ebeffad41e39dda80159bc27605f5f247174c9.tar.gz
volse-hubzilla-27ebeffad41e39dda80159bc27605f5f247174c9.tar.bz2
volse-hubzilla-27ebeffad41e39dda80159bc27605f5f247174c9.zip
update_poll() can be called many times in a row for the same item if a multiple poll is being updated. This could result in the queueworker not processing duplicates. We are now adding the source item mid to the notifier call as the third argument (fragment) so that the queueworker will not think they are duplicates. The fragment is also passed to the deliver_hooks call in the notifier
Diffstat (limited to 'Zotlabs/Daemon')
-rw-r--r--Zotlabs/Daemon/Notifier.php10
1 files changed, 8 insertions, 2 deletions
diff --git a/Zotlabs/Daemon/Notifier.php b/Zotlabs/Daemon/Notifier.php
index 23bddae8f..76c17545a 100644
--- a/Zotlabs/Daemon/Notifier.php
+++ b/Zotlabs/Daemon/Notifier.php
@@ -78,6 +78,10 @@ class Notifier {
static public $encoded_item = null;
static public $channel = null;
static public $private = false;
+ // $fragment can contain additional info to omit de-duplication in the queueworker.
+ // E.g. if an item is updated many times in a row from different sources (multiple vote updates) the
+ // update source mid or a timestamp or random string can be added.
+ static public $fragment = null;
static public function run($argc, $argv) {
@@ -88,7 +92,6 @@ class Notifier {
logger('notifier: invoked: ' . print_r($argv, true), LOGGER_DEBUG);
$cmd = $argv[1];
-
$item_id = $argv[2];
if (!$item_id) {
@@ -103,6 +106,7 @@ class Notifier {
self::$encoded_item = null;
self::$channel = null;
self::$private = false;
+ self::$fragment = null;
$sys = get_sys_channel();
$normal_mode = true;
@@ -222,6 +226,8 @@ class Notifier {
// Fetch the target item
+ self::$fragment = $argv[3] ?? '';
+
$r = q("SELECT * FROM item WHERE id = %d AND parent != 0",
intval($item_id)
);
@@ -685,7 +691,7 @@ class Notifier {
// This wastes a process if there are no delivery hooks configured, so check this before launching the new process
$x = q("select * from hook where hook = 'notifier_normal'");
if ($x) {
- Master::Summon(['Deliver_hooks', $target_item['id']]);
+ Master::Summon(['Deliver_hooks', $target_item['id'], self::$fragment]);
}
}