detached fab9d89

fix(daemon): release switch purge admission once membership commits

Holding it through transition cleanups and first paint let a slow client stall a concurrent KillAll drain until it timed out.
commit
fab9d890a7d3eda20cd7e31600b8a238801f3ae7
author
brice · · 2026-10-08 06:22 UTC
committer
brice · · 2026-10-08 06:24 UTC
parent
261a65d
signature
GPG VerifiedCD88F9E564E0102646FB6077A1A07C7C7C3E349D · arch-gpg Verified for the committer email
1 file · +8 -1
M internal/usecase/daemon/same_peer_switch.go +8 -1
@@ -1,6 +1,8 @@
11 package daemon
22
33 import (
4+ "sync"
5+
46 "github.com/bnema/vev/internal/domain"
57 "github.com/bnema/vev/internal/protocol"
68 )
@@ -82,7 +84,11 @@ func (d *Daemon) switchSamePeerForAttachment(effect *attachmentEffect, request p
8284 }
8385 d.purgeAdmissionActive++
8486 d.mu.Unlock()
85- defer d.releasePurgeAdmission()
87+ // The reservation covers only the membership change; first paint can
88+ // block on a slow client and must not stall a purge's drain.
89+ var releaseOnce sync.Once
90+ release := func() { releaseOnce.Do(d.releasePurgeAdmission) }
91+ defer release()
8692
8793 target, targetTabIndex, ok := d.samePeerTarget(request)
8894 if !ok || target == effect.sess {
@@ -112,6 +118,7 @@ func (d *Daemon) switchSamePeerForAttachment(effect *attachmentEffect, request p
112118 d.sendSamePeerSwitchFailure(effect, request.RequestID, protocol.SamePeerSwitchStaleTarget)
113119 return
114120 }
121+ release()
115122
116123 if fresh, admitted := effect.ac.beginAttachmentEffect(transition.published); admitted {
117124 fresh.End()
@@ -1,6 +1,8 @@
1 package daemon1 package daemon
2 2
3 import (3 import (
4+ "sync"
5+
4 "github.com/bnema/vev/internal/domain"6 "github.com/bnema/vev/internal/domain"
5 "github.com/bnema/vev/internal/protocol"7 "github.com/bnema/vev/internal/protocol"
6 )8 )
@@ -82,7 +84,11 @@ func (d *Daemon) switchSamePeerForAttachment(effect *attachmentEffect, request p
82 }84 }
83 d.purgeAdmissionActive++85 d.purgeAdmissionActive++
84 d.mu.Unlock()86 d.mu.Unlock()
85- defer d.releasePurgeAdmission()87+ // The reservation covers only the membership change; first paint can
88+ // block on a slow client and must not stall a purge's drain.
89+ var releaseOnce sync.Once
90+ release := func() { releaseOnce.Do(d.releasePurgeAdmission) }
91+ defer release()
86 92
87 target, targetTabIndex, ok := d.samePeerTarget(request)93 target, targetTabIndex, ok := d.samePeerTarget(request)
88 if !ok || target == effect.sess {94 if !ok || target == effect.sess {
@@ -112,6 +118,7 @@ func (d *Daemon) switchSamePeerForAttachment(effect *attachmentEffect, request p
112 d.sendSamePeerSwitchFailure(effect, request.RequestID, protocol.SamePeerSwitchStaleTarget)118 d.sendSamePeerSwitchFailure(effect, request.RequestID, protocol.SamePeerSwitchStaleTarget)
113 return119 return
114 }120 }
121+ release()
115 122
116 if fresh, admitted := effect.ac.beginAttachmentEffect(transition.published); admitted {123 if fresh, admitted := effect.ac.beginAttachmentEffect(transition.published); admitted {
117 fresh.End()124 fresh.End()

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 12

Tags 11

↑↓ moveenter openesc close