Fail an approval request fast when no subscriber received the prompt

This commit is contained in:
Viktor Liu
2026-08-29 16:00:36 +02:00
parent e104cef490
commit d0d8813dcb
5 changed files with 45 additions and 6 deletions

View File

@@ -76,13 +76,15 @@ var (
// owned by sessionwatch, not the caller.
type StatusRecorder interface {
SetSessionExpiresAt(deadline time.Time)
// PublishEvent reports whether any subscriber received the event; the
// watcher does not act on it.
PublishEvent(
severity cProto.SystemEvent_Severity,
category cProto.SystemEvent_Category,
message string,
userMessage string,
metadata map[string]string,
)
) bool
}
// Watcher observes the latest session deadline and fires two warnings

View File

@@ -64,7 +64,7 @@ func (r *fakeRecorder) PublishEvent(
message string,
_ string,
metadata map[string]string,
) {
) bool {
r.mu.Lock()
defer r.mu.Unlock()
r.events = append(r.events, event{
@@ -74,6 +74,7 @@ func (r *fakeRecorder) PublishEvent(
message: message,
meta: metadata,
})
return true
}
func (r *fakeRecorder) snapshot() []event {