@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

Add "Understanding Event Triggers" article to Diviner

Summary:
Add a stub article with some notes on Event Triggers as I believe that they have potential but are not very documented.

Closes T16183

Test Plan:
* Run `./bin/diviner generate`
* Go to http://phorge.localhost/book/contrib/article/event_triggers/ (article) and http://phorge.localhost/book/phorge/article/managing_daemons/ (new link)

Reviewers: O1 Blessed Committers, valerio.bozzolan

Reviewed By: O1 Blessed Committers, valerio.bozzolan

Subscribers: tobiaswiese, valerio.bozzolan, Matthew, Cigaryno

Maniphest Tasks: T16183

Differential Revision: https://we.phorge.it/D26204

+46 -2
+44
src/docs/contributor/event_triggers.diviner
··· 1 + @title Understanding Event Triggers 2 + @group developer 3 + 4 + Incomplete notes on implementing and using Event Triggers. 5 + 6 + = Overview = 7 + 8 + Phorge has an internal framework to schedule certain activity at certain times, 9 + called Event Triggers. 10 + 11 + Event Triggers are internal, automated, regular, and can access other parts of 12 + the Phorge codebase. 13 + In comparison, external bot software interacts with Phorge by calling Conduit 14 + API endpoints (see @{article:Conduit API Overview}) to perform actions. 15 + 16 + = Use = 17 + 18 + Event Triggers can be monitored under "Upcoming Triggers" in the Daemon Console 19 + (at `/daemon/` in the web UI). 20 + 21 + As of 2025, the only utilization of the Event Triggers framework exists when 22 + importing an externally hosted calendar file into the Calendar prototype 23 + application and configuring Phorge to regularly update its data copy by pulling 24 + the latest version of that external file. Additional use cases will obviously 25 + require additional code paths to be executed which set up additional triggers, 26 + as Event Triggers cannot be created by external software. 27 + 28 + = Database = 29 + 30 + An Event Trigger is stored in the "phabricator_worker" database. 31 + 32 + The table "worker_triggerevent" stores the previous and the next execution 33 + timestamp, for example: 34 + 35 + | id | triggerID | lastEventEpoch | nextEventEpoch | 36 + |----|-----------|----------------|----------------| 37 + | 1 | 1 | NULL | 1751623688 | 38 + 39 + The table "worker_trigger" stores the configuration and type of an Event 40 + Trigger, for example: 41 + 42 + | id | phid | triggerVersion | clockClass | clockProperties | actionClass | actionProperties | 43 + |----|--------------------------------|----------------|-----------------------------------|-----------------|--------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| 44 + | 1 | PHID-TRIG-ywy5v5zouv744zhnjed5 | 1 | PhabricatorMetronomicTriggerClock | {"period":3600} | PhabricatorScheduleTaskTriggerAction | {"class":"PhabricatorCalendarImportReloadWorker","data":{"importPHID":"PHID-CIMP-ielkbnijgs5w6hmjsypu","via":"trigger"},"options":{"objectPHID":"PHID-CIMP-ielkbnijgs5w6hmjsypu","priority":3000}} |
+2 -2
src/docs/user/configuration/managing_daemons.diviner
··· 123 123 - **PhabricatorTaskmasterDaemon** performs work from a task queue; 124 124 - **PhabricatorRepositoryPullLocalDaemon** daemons track repositories, for 125 125 more information see @{article:Diffusion User Guide}; and 126 - - **PhabricatorTriggerDaemon** schedules event triggers and cleans up old 127 - logs and caches. 126 + - **PhabricatorTriggerDaemon** schedules event triggers (see 127 + @{article:Understanding Event Triggers}) and cleans up old logs and caches. 128 128 129 129 = Debugging and Tuning = 130 130