Merge pull request #3544 from annando/poller-bugfix-again

Bugfix: Poller entries had been executed multiple times
This commit is contained in:
Tobias Diekershoff 2017-06-21 10:04:13 +02:00 committed by GitHub
commit 4ab736860c
3 changed files with 8 additions and 5 deletions

View File

@ -2124,6 +2124,10 @@ function drop_item($id, $interactive = true) {
$item = $r[0];
if ($item['deleted']) {
return 0;
}
$owner = $item['uid'];
$contact_id = 0;

View File

@ -519,8 +519,8 @@ function notifier_run(&$argv, &$argc){
}
$r1 = q("SELECT `batch`, ANY_VALUE(`id`) AS `id`, ANY_VALUE(`name`) AS `name`, ANY_VALUE(`network`) AS `network`
FROM `contact` WHERE `network` = '%s'
AND `uid` = %d AND `rel` != %d AND NOT `blocked` AND NOT `pending` AND NOT `archive` GROUP BY `batch` ORDER BY rand()",
FROM `contact` WHERE `network` = '%s' AND `batch` != ''
AND `uid` = %d AND `rel` != %d AND NOT `blocked` AND NOT `pending` AND NOT `archive` GROUP BY `batch`",
dbesc(NETWORK_DIASPORA),
intval($owner['uid']),
intval(CONTACT_IS_SHARING)
@ -528,8 +528,7 @@ function notifier_run(&$argv, &$argc){
}
$r2 = q("SELECT `id`, `name`,`network` FROM `contact`
WHERE `network` in ( '%s', '%s') AND `uid` = %d AND NOT `blocked` AND NOT `pending` AND NOT `archive`
AND `rel` != %d order by rand() ",
WHERE `network` in ('%s', '%s') AND `uid` = %d AND NOT `blocked` AND NOT `pending` AND NOT `archive` AND `rel` != %d",
dbesc(NETWORK_DFRN),
dbesc(NETWORK_MAIL2),
intval($owner['uid']),

View File

@ -678,7 +678,7 @@ function poller_worker_process() {
$poller_db_duration += (microtime(true) - $stamp);
if ($found) {
$r = q("SELECT * FROM `workerqueue` WHERE `pid` = %d", intval(getmypid()));
$r = q("SELECT * FROM `workerqueue` WHERE `pid` = %d AND NOT `done`", intval(getmypid()));
}
return $r;
}