๐ (mirrors): Stop scheduled drain racing tests via config-driven interval
Changes
4 files changed, +8 -3
MODIFY
docs/admins/getting-started.md
+1 -0
@@ -342,6 +342,7 @@
342
342
| `GITSHARK_SECRET_KEY` | โ | โ | Encrypts push-mirror secrets at rest; required to create mirrors (see [Push mirrors](mirrors.md)) |
343
343
| `GITSHARK_MIRROR_MAX_ATTEMPTS` | โ | `8` | Mirror-sync retry cap before dead-letter |
344
344
| `GITSHARK_MIRROR_ALLOW_INSECURE` | โ | `false` | Dev only: allow http/loopback mirror targets |
345
+| `GITSHARK_MIRROR_DRAIN_INTERVAL` | โ | `10s` | How often the async mirror-sync drain worker runs |
345
346
| `GITSHARK_FEDERATION_ENABLED` | โ | `false` | Turn on ForgeFed/ActivityPub |
346
347
| `GITSHARK_FEDERATION_BASE_URL` | โ | โ | Public HTTPS origin; permanent actor-ID base |
347
348
| `GITSHARK_FEDERATION_PEER_ALLOWLIST` | โ | โ | Comma-separated peer hosts (empty denies all) |
MODIFY
docs/admins/mirrors.md
+2 -2
@@ -43,8 +43,8 @@
43
43
- A push enqueues one sync per enabled mirror of the repository. At most **one pending
44
44
sync per mirror** exists โ rapid pushes coalesce (the sync always pushes the *current*
45
45
state, so this is lossless).
46
-- A scheduled worker drains due syncs **every 10 s**. Failures retry with exponential
47
- backoff (1 min, 2 min, 4 min, โฆ capped at 1 h).
46
+- A scheduled worker drains due syncs **every 10 s** (`GITSHARK_MIRROR_DRAIN_INTERVAL`).
47
+ Failures retry with exponential backoff (1 min, 2 min, 4 min, โฆ capped at 1 h).
48
48
- After `GITSHARK_MIRROR_MAX_ATTEMPTS` failed attempts a sync is dead-lettered
49
49
(`FAILED`) and retries stop. The next push to the repository (or the owner's
50
50
*Push now*) enqueues a fresh sync.
MODIFY
src/main/java/de/workaround/mirror/MirrorService.java
+1 -1
@@ -191,7 +191,7 @@
191
191
}
192
192
193
193
/** Scheduled drain pass โ picks up due syncs and attempts each. */
194
- @Scheduled(every = "10s", concurrentExecution = Scheduled.ConcurrentExecution.SKIP)
194
+ @Scheduled(every = "{gitshark.mirror.drain-interval}", concurrentExecution = Scheduled.ConcurrentExecution.SKIP)
195
195
void drain()
196
196
{
197
197
drainOnce();
MODIFY
src/main/resources/application.properties
+4 -0
@@ -116,12 +116,16 @@
116
116
gitshark.secret-key=${GITSHARK_SECRET_KEY:}
117
117
gitshark.mirror.max-attempts=${GITSHARK_MIRROR_MAX_ATTEMPTS:8}
118
118
gitshark.mirror.allow-insecure=${GITSHARK_MIRROR_ALLOW_INSECURE:false}
119
+# How often the async drain worker picks up due syncs. Large in tests so the scheduler never
120
+# fires mid-test and races the test's own drainOnce() (same pattern as the federation resync).
121
+gitshark.mirror.drain-interval=${GITSHARK_MIRROR_DRAIN_INTERVAL:10s}
119
122
# Dev/test convenience (same pattern as the fixed dev OIDC secrets): a fixed key so mirrors work
120
123
# out of the box, and insecure targets allowed so a local instance can mirror to localhost.
121
124
# Production has no default โ set GITSHARK_SECRET_KEY explicitly.
122
125
%dev,test.gitshark.secret-key=dev-only-mirror-secret-key-0123456789
123
126
%dev.gitshark.mirror.allow-insecure=true
124
127
%test.gitshark.mirror.allow-insecure=true
128
+%test.gitshark.mirror.drain-interval=1h
125
129
126
130
# Federation (ActivityPub / ForgeFed) โ disabled by default.
127
131
# base-url is the public origin of this instance (e.g. https://shark.example); actor IDs are