@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 Diffusion User Guide: Repository Updates
2@group userguide
3
4Explains how Diffusion updates repositories to discover new changes.
5
6Overview
7========
8
9When Phorge is configured to import repositories which are hosted
10elsewhere, it needs to poll those repositories for changes. If it polls too
11frequently, it can create too much load locally and on remote services. If it
12polls too rarely, it may take a long time for commits to show up in the web
13interface.
14
15This document describes the rules around polling and how to understand and
16adjust the behavior. In general:
17
18 - Phorge chooses a default poll interval based on repository
19 activity. These intervals range from every 15 seconds (for active
20 repositories) to every 6 hours (for repositories with no commits in two
21 months).
22 - If you use `arc` to push commits, or you host repositories on Phorge,
23 repositories automatically update after changes are pushed.
24 - If you don't use `arc` and your repository is hosted elsewhere, this
25 document describes ways you can make polling more responsive.
26
27
28Default Behavior
29================
30
31By default, Phorge determines how frequently to poll repositories by
32examining how long it has been since the last commit. In most cases this is
33fairly accurate and produces good behavior. In particular, it automatically
34reduces the polling frequency for rarely-used repositories. This dramatically
35reduces load for installs with a large number of inactive repositories, which
36is common.
37
38For repositories with activity in the last 3 days, we wait 1 second for every
3910 minutes without activity. The table below has some examples.
40
41| Time Since Commit | Poll Interval |
42|-------------------|------------------|
43| //Minimum// | 15 seconds |
44| 6h | about 30 seconds |
45| 12h | about 1 minute |
46| 1 day | about 2 minutes |
47| 2 days | about 5 minutes |
48| 3 days | about 7 minutes |
49
50This means that you may need to wait about 2 minutes for the first commit to
51be imported in the morning, and about 5 minutes after a long weekend, but other
52commits to active repositories should usually be recognized in 30 seconds or
53less.
54
55For repositories with no activity in the last 3 days, we wait longer between
56updates (1 second for every 4 minutes without activity). The table below has
57some examples.
58
59| Time Since Commit | Poll Interval |
60|-------------------|------------------|
61| 4 days | about 30 minutes |
62| 7 days | about 45 minutes |
63| 10 days | about 1 hour |
64| 20 days | about 2 hours |
65| 30 days | about 3 hours |
66| //Maximum// | 6 hours |
67
68You can find the exact default poll frequency of a repository in
69Diffusion > (Choose a Repository) > Edit Repository, under "Update Frequency".
70You can also see the time when the repository was last updated in this
71interface.
72
73Repositories that are currently importing are always updated at the minimum
74update frequency so the import finishes as quickly as possible.
75
76
77Triggering Repository Updates
78=============================
79
80If you want Phorge to update a repository more quickly than the default
81update frequency (for example, because you just pushed a commit to it), you can
82tell Phorge that it should schedule an update as soon as possible.
83
84There are several ways to do this:
85
86 - If you push changes with `arc land` or `arc commit`, this will be done
87 for you automatically. These commits should normally be recognized within
88 a few seconds.
89 - If your repository is hosted on Phorge, this will also be done for you
90 automatically.
91 - You can schedule an update from the web interface, in Diffusion >
92 (Choose a Repository) > Manage Repository > Status > Update Now.
93 - You can make a call to the Conduit API method `diffusion.looksoon`. This
94 hints to Phorge that it should poll a repository as soon as it can.
95 All of the other mechanisms do this under the hood.
96
97In particular, you may be able to add a commit hook to your external repository
98which calls `diffusion.looksoon`. This should make an external repository about
99as responsive as a hosted repository.
100
101If a repository has an update scheduled, the Diffusion > (Choose a
102Repository) > Edit Repository interface will show that the repository is
103prioritized and will be updated soon.
104
105
106Troubleshooting Updates
107=======================
108
109You can manually run a repository update from the command line to troubleshoot
110issues, using the `--trace` flag to get full details:
111
112 phorge/ $ ./bin/repository update --trace <repository>
113
114To catch potential issues with permissions, run this command as the same user
115that the daemons run as.
116
117Next Steps
118==========
119
120Continue by:
121
122 - troubleshooting in greater depth with
123 @{article:Troubleshooting Repository Imports}.