Skip to content

Commit 52f1586

Browse files
author
Delta-Kronecker
committed
launcher: stricter circuit monitor (10 s check, 20 s cooldown, close on first weak pass, min 1 leg/set)
1 parent 7bdca69 commit 52f1586

3 files changed

Lines changed: 68 additions & 11 deletions

File tree

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
name: Sync Release Notes
2+
3+
on:
4+
workflow_dispatch:
5+
release:
6+
types: [published]
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
sync:
13+
name: Rewrite release notes from tagged commits
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Rewrite release notes from tagged commits
17+
shell: bash
18+
env:
19+
GH_TOKEN: ${{ github.token }}
20+
run: |
21+
set -euo pipefail
22+
REPO="${{ github.repository }}"
23+
24+
echo "Resolving tags to commits..."
25+
declare -A tag_commit
26+
while read -r ref sha type; do
27+
tag="${ref#refs/tags/}"
28+
if [ "$type" = "commit" ]; then
29+
tag_commit["$tag"]="$sha"
30+
else
31+
tag_commit["$tag"]="$(gh api "repos/$REPO/git/tags/$sha" --jq '.object.sha')"
32+
fi
33+
done < <(gh api "repos/$REPO/git/refs/tags?per_page=100" --paginate --jq '.[] | "\(.ref) \(.object.sha) \(.object.type)"')
34+
35+
echo "Syncing release notes..."
36+
updated=0
37+
unchanged=0
38+
gh api "repos/$REPO/releases?per_page=100" --paginate --jq '.[] | .tag_name' |
39+
while read -r tag; do
40+
sha="${tag_commit[$tag]:-}"
41+
if [ -z "$sha" ]; then
42+
echo "skip $tag (no matching tag ref)"
43+
continue
44+
fi
45+
msg="$(gh api "repos/$REPO/commits/$sha" --jq '.commit.message')"
46+
current="$(gh release view "$tag" --repo "$REPO" --json body --jq .body 2>/dev/null || true)"
47+
if [ "$msg" = "$current" ]; then
48+
echo "unchanged $tag"
49+
unchanged=$((unchanged + 1))
50+
continue
51+
fi
52+
printf '%s\n' "$msg" > notes.md
53+
gh release edit "$tag" --repo "$REPO" --notes-file notes.md
54+
echo "updated $tag"
55+
updated=$((updated + 1))
56+
done
57+
58+
echo "Done: $updated updated, $unchanged unchanged"

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,17 +181,17 @@ physical interface, so tor's outbound TLS never loops back into the tunnel.
181181
### Circuit health monitor
182182

183183
While Tor is up, TorJet watches the conflux legs via the control port. Every
184-
20 s it asks tor for the conflux set list (`CONFLUX QUERY`) and prunes low
184+
10 s it asks tor for the conflux set list (`CONFLUX QUERY`) and prunes low
185185
quality legs so tor rebuilds them with fresh circuits:
186186

187187
- a linked leg is **weak** when its RTT is at/above an absolute threshold
188188
(`--watch-rtt`, default 1000 ms) or it is clearly slower than the best leg of
189189
its own set (`>= --watch-rtt-floor` ms and `>= --watch-factor` times the set
190190
best, defaults 400 ms and 2.0x);
191-
- a leg must stay weak for `--watch-strikes` consecutive passes (default 2)
192-
before it is closed, so a single RTT spike never prunes a healthy leg;
191+
- a leg must stay weak for `--watch-strikes` consecutive passes (default 1)
192+
before it is closed, so a single bad measurement closes it right away;
193193
- the best (lowest RTT) leg of each set is never closed, and a set is never
194-
pruned below `--watch-min-legs` (default 2);
194+
pruned below `--watch-min-legs` (default 1);
195195
- legs stuck **unlinked** for `--watch-unlinked-strikes` passes (default 4)
196196
AND older than `--watch-unlinked-grace` seconds (default 120) are closed as
197197
dead weight, but never during tunnel warmup when everything is still
@@ -201,7 +201,7 @@ quality legs so tor rebuilds them with fresh circuits:
201201

202202
tor launches a replacement leg for every closed leg (sets below the configured
203203
`ConfluxNumLegs` target are also topped up with `CONFLUX ADD`), and conflux
204-
migrates streams onto the fresh circuits. A 60 s cooldown between closes keeps
204+
migrates streams onto the fresh circuits. A 20 s cooldown between closes keeps
205205
the circuit set stable (relaxed during tunnel warmup). Disable it with
206206
`--no-circuit-watch`; tune it with `--watch-rtt <ms>`, `--watch-interval
207207
<seconds>`, `--watch-cooldown <seconds>` and the other `--watch-*` flags.

scripts/start-tor.cs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -149,13 +149,13 @@ internal static class Program
149149
private static int watchRttMs = 1000;
150150
private static int watchRttFloorMs = 400;
151151
private static double watchFactor = 2.0;
152-
private static int watchStrikes = 2;
153-
private static int watchMinLegs = 2;
152+
private static int watchStrikes = 1;
153+
private static int watchMinLegs = 1;
154154
private static int watchUnlinkedStrikes = 4;
155155
private static int watchUnlinkedGraceS = 120;
156156
private static int watchMaxPerPass = 6;
157-
private static int watchIntervalS = 20;
158-
private static int watchCooldownS = 60;
157+
private static int watchIntervalS = 10;
158+
private static int watchCooldownS = 20;
159159

160160
// Per-circuit consecutive-bad counters for the monitor (persist across
161161
// passes so a single RTT spike never prunes a healthy leg).
@@ -1600,8 +1600,7 @@ private static void CircuitWatchLoop()
16001600
// (>= --watch-rtt-floor ms AND >= --watch-factor times the
16011601
// set's best RTT), so pruning adapts to each set's conditions.
16021602
// A leg must stay weak for --watch-strikes consecutive passes
1603-
// before it is closed, so a single measurement spike never prunes
1604-
// a good leg. Legs stuck UNLINKED for --watch-unlinked-strikes
1603+
// before it is closed. Legs stuck UNLINKED for --watch-unlinked-strikes
16051604
// passes are closed as dead weight. The best (lowest RTT) leg of
16061605
// each set is never closed, and a set is never pruned below
16071606
// --watch-min-legs.

0 commit comments

Comments
 (0)