@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@title Understanding Event Triggers
2@group developer
3
4Incomplete notes on implementing and using Event Triggers.
5
6= Overview =
7
8Phorge has an internal framework to schedule certain activity at certain times,
9called Event Triggers.
10
11Event Triggers are internal, automated, regular, and can access other parts of
12the Phorge codebase.
13In comparison, external bot software interacts with Phorge by calling Conduit
14API endpoints (see @{article:Conduit API Overview}) to perform actions.
15
16= Use =
17
18Event Triggers can be monitored under "Upcoming Triggers" in the Daemon Console
19(at `/daemon/` in the web UI).
20
21As of 2025, the only utilization of the Event Triggers framework exists when
22importing an externally hosted calendar file into the Calendar prototype
23application and configuring Phorge to regularly update its data copy by pulling
24the latest version of that external file. Additional use cases will obviously
25require additional code paths to be executed which set up additional triggers,
26as Event Triggers cannot be created by external software.
27
28= Database =
29
30An Event Trigger is stored in the "phabricator_worker" database.
31
32The table "worker_triggerevent" stores the previous and the next execution
33timestamp, for example:
34
35| id | triggerID | lastEventEpoch | nextEventEpoch |
36|----|-----------|----------------|----------------|
37| 1 | 1 | NULL | 1751623688 |
38
39The table "worker_trigger" stores the configuration and type of an Event
40Trigger, 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}} |