Skip to content

fix: delay debounce until the first event - #1091

Open
immanuwell wants to merge 1 commit into
cilium:masterfrom
immanuwell:fix/debounce-first-touch
Open

fix: delay debounce until the first event#1091
immanuwell wants to merge 1 commit into
cilium:masterfrom
immanuwell:fix/debounce-first-touch

Conversation

@immanuwell

@immanuwell immanuwell commented Jun 15, 2026

Copy link
Copy Markdown

ControlStream starts waiting on nsDebounce.Triggered() right away. Before this fix, Triggered() armed the timer on first read, so an idle stream could send an empty namespaces update after 100ms even when no namespace event ever happened. Kinda noisy.

Fix is small:

  • keep debounce idle until the first Touch()
  • add tests for no pre-touch trigger, normal trigger, and reset-on-touch

Repro:

  1. On master, run this in backend:
cat >/tmp/repro.go <<'EOF'
package main

import (
  "fmt"
  "time"

  "github.com/cilium/hubble-ui/backend/pkg/debounce"
)

func main() {
  d := debounce.New(50 * time.Millisecond)
  select {
  case <-d.Triggered():
    fmt.Println("triggered without touch")
  case <-time.After(120 * time.Millisecond):
    fmt.Println("no trigger")
  }
}
EOF
go run /tmp/repro.go
  1. On master it prints triggered without touch.
  2. With this branch it prints no trigger.
  3. go test ./... still passes.

Signed-off-by: immanuwell <pchpr.00@list.ru>
@immanuwell
immanuwell requested a review from a team as a code owner June 15, 2026 16:02
@immanuwell
immanuwell requested review from geakstr and removed request for a team June 15, 2026 16:02
@immanuwell

Copy link
Copy Markdown
Author

@geakstr please take a look

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant