gitshark

Clone repository

git clone https://gitshark.de/git/workaround/Gitshark.git
git clone git@gitshark.de:workaround/Gitshark.git

← Commits

๐Ÿ› (mirrors): Stop scheduled drain racing tests via config-driven interval

7eb9cc7d1dea057e79fbbf84e231d024c5b964a0 ยท Michael Hainz ยท 2026-07-17T13:31:08Z

Changes

4 files changed, +8 -3

MODIFY docs/admins/getting-started.md +1 -0
diff --git a/docs/admins/getting-started.md b/docs/admins/getting-started.md
index f178e42..31e983e 100644
--- a/docs/admins/getting-started.md
+++ b/docs/admins/getting-started.md
@@ -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
diff --git a/docs/admins/mirrors.md b/docs/admins/mirrors.md
index 5d7111a..a89be45 100644
--- a/docs/admins/mirrors.md
+++ b/docs/admins/mirrors.md
@@ -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
diff --git a/src/main/java/de/workaround/mirror/MirrorService.java b/src/main/java/de/workaround/mirror/MirrorService.java
index 7a2676b..da8380c 100644
--- a/src/main/java/de/workaround/mirror/MirrorService.java
+++ b/src/main/java/de/workaround/mirror/MirrorService.java
@@ -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
diff --git a/src/main/resources/application.properties b/src/main/resources/application.properties
index a058d0f..c424c35 100644
--- a/src/main/resources/application.properties
+++ b/src/main/resources/application.properties
@@ -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

Keyboard shortcuts

?Show this help
g hGo home
EscClose dialog