scylladb / gocql

Package gocql implements a fast and robust ScyllaDB client for the Go programming language.
https://docs.scylladb.com/stable/using-scylla/drivers/cql-drivers/scylla-go-driver.html
BSD 3-Clause "New" or "Revised" License
189 stars 59 forks source link

fix(simple_debouncer_test): make sure first call is picked up before making more calls #329

Closed dkropachev closed 1 week ago

dkropachev commented 2 weeks ago

Fix https://github.com/scylladb/gocql/issues/328

Test can stuck at:

goroutine 23 [runnable]:
runtime.Gosched()
    /opt/hostedtoolcache/go/1.23.2/x64/src/runtime/proc.go:353 +0x14
github.com/gocql/gocql/debounce.waitTillChannelIsEmpty(...)
    /home/runner/work/gocql/gocql/debounce/simple_debouncer_test.go:53
github.com/gocql/gocql/debounce.TestSimpleDebouncer.func3(0xc0000b09c0)
    /home/runner/work/gocql/gocql/debounce/simple_debouncer_test.go:41 +0x2a5

Due to fact that:

        startedCh <- struct{}{}
        go d.Debounce(fn)
        go d.Debounce(fn)

Could be executed before debouncer starts first call execution.