@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

make Trigger Daemon sleep correctly when one-time triggers exist

Summary:
Trigger daemon is trying to find the next event to invoke before sleeping, but the query includes already-elapsed triggers.
It then tries to sleep for 0 seconds.

Test Plan:
On a new instance, schedule a single trigger of type `PhabricatorOneTimeTriggerClock` to a very near time.

Use top to see trigger daemon not going to 100% CPU once the event has elapsed.

Reviewers: #blessed_reviewers, epriestley

Subscribers: Korvin

Differential Revision: https://secure.phabricator.com/D15750

Aviv Eyal a3bb35e9 091a64e9

+2 -1
+2 -1
src/infrastructure/daemon/workers/PhabricatorTriggerDaemon.php
··· 261 261 * Get the number of seconds to sleep for before starting the next scheduling 262 262 * phase. 263 263 * 264 - * If no events are scheduled soon, we'll sleep for 60 seconds. Otherwise, 264 + * If no events are scheduled soon, we'll sleep briefly. Otherwise, 265 265 * we'll sleep until the next scheduled event. 266 266 * 267 267 * @return int Number of seconds to sleep for. ··· 272 272 $next_triggers = id(new PhabricatorWorkerTriggerQuery()) 273 273 ->setViewer($this->getViewer()) 274 274 ->setOrder(PhabricatorWorkerTriggerQuery::ORDER_EXECUTION) 275 + ->withNextEventBetween(0, null) 275 276 ->setLimit(1) 276 277 ->needEvents(true) 277 278 ->execute();