@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
at recaptime-dev/main 83 lines 3.2 kB view raw
1@title Managing the Worker Queue 2@group fieldmanual 3 4Advanced guide to managing the background worker task queue. 5 6Overview 7======== 8 9Phorge uses daemonized worker processes to execute some tasks (like 10importing repositories and sending mail) in the background. 11 12In most cases, this queue will automatically execute tasks in an appropriate 13order. However, in some cases you may want to exercise greater control over 14which tasks execute, when, and at what priority. 15 16Reference: Priority Levels 17========================== 18 19Tasks queued by Phorge use these default priority levels: 20 21| Priority | Name | Tasks | 22|---|---|---| 23| 1000 | `ALERTS` | Time-sensitive notifications and email. | 24| 2000 | `DEFAULT` | Normal publishing and processing. | 25| 2500 | `COMMIT` | Import of commits in existing repositories. | 26| 3000 | `BULK` | Edits applied via "Bulk Edit" interface. | 27| 3500 | `INDEX` | Search engine index updates. | 28| 4000 | `IMPORT` | Import of commits in new repositories. | 29 30Tasks with smaller priority numbers execute before tasks with larger priority 31numbers (for example, a task with priority 1000 will execute before a task 32with priority 2000). 33 34Any positive integer is a valid priority level, and if you adjust the priority 35of tasks with `bin/worker priority` you may select any level even if 36Phorge would never naturally queue tasks at that level. For example, you 37may adjust tasks to priority `5678`, which will make them execute after all 38other types of natural tasks. 39 40Although tasks usually execute in priority order, task execution order is not 41strictly a function of priority, and task priority does not guarantee execution 42order. 43 44Large Repository Imports 45======================== 46 47The most common case where you may want to make an adjustment to the default 48behavior of the worker queue is when importing a very large repository like 49the Linux kernel. 50 51Although Phorge will automatically process imports of new repositories at 52a lower priority level than all other non-import tasks, you may still run into 53issues like these: 54 55 - You may also want to import one or more //other// new repositories, and 56 would prefer they import at a higher priority. 57 - You may find overall repository performance is impacted by the large 58 repository import. 59 60You can manually change the priority of tasks with `bin/worker priority`. For 61example, if your copy of the Linux repository is `R123` and you'd like it to 62import at a lower priority than all other tasks (including other imports of 63new repositories), you can run a command like this: 64 65``` 66phorge/ $ ./bin/worker priority --priority 5000 --container R123 67``` 68 69This means: set all tasks associated with container `R123` (in this example, 70the Linux repository) to priority 5000 (which is lower than any natural 71priority). 72 73You can delay tasks until later with `bin/worker delay`, which allows you to 74schedule tasks to execute at night or over the weekend. For example, to 75pause an import for 6 hours, run a command like this: 76 77``` 78phorge/ $ ./bin/worker delay --until "6 hours" --container R123 79``` 80 81The selected tasks will not execute until 6 hours from the time this command 82is issued. You can also provide an explicit date, or "now" to let tasks begin 83execution immediately.