Rename to reconnect timeout.

This commit is contained in:
Jay
2026-04-18 10:59:45 -04:00
parent a8fb478971
commit 2d5e55ccaa
4 changed files with 28 additions and 22 deletions

View File

@@ -112,7 +112,7 @@ func TestRunHealthMonitor(t *testing.T) {
stop := make(chan struct{})
defer close(stop)
w := &Worker{config: &WorkerConfig{IdleTimeout: 100 * time.Millisecond}}
w := &Worker{config: &WorkerConfig{ReconnectTimeout: 100 * time.Millisecond}}
go w.runHealthMonitor(heartbeat, reconnect, stop, nil)
// send heartbeats faster than the timeout
@@ -132,13 +132,13 @@ func TestRunHealthMonitor(t *testing.T) {
}, honeybeetest.NegativeTestTimeout, honeybeetest.TestTick)
})
t.Run("idle timeout fires reconnect", func(t *testing.T) {
t.Run("reconnect timeout fires reconnect", func(t *testing.T) {
heartbeat := make(chan struct{})
reconnect := make(chan struct{}, 1)
stop := make(chan struct{})
defer close(stop)
w := &Worker{config: &WorkerConfig{IdleTimeout: 20 * time.Millisecond}}
w := &Worker{config: &WorkerConfig{ReconnectTimeout: 20 * time.Millisecond}}
go w.runHealthMonitor(heartbeat, reconnect, stop, nil)
// send no heartbeats, wait for timeout and reconnect signal
@@ -157,7 +157,7 @@ func TestRunHealthMonitor(t *testing.T) {
reconnect := make(chan struct{}, 1)
stop := make(chan struct{})
w := &Worker{config: &WorkerConfig{IdleTimeout: 20 * time.Second}}
w := &Worker{config: &WorkerConfig{ReconnectTimeout: 20 * time.Second}}
done := make(chan struct{})
go func() {
w.runHealthMonitor(heartbeat, reconnect, stop, nil)
@@ -177,3 +177,9 @@ func TestRunHealthMonitor(t *testing.T) {
})
}
func TestRunReconnector(t *testing.T) {
t.Run("reconnect emits events, new connection", func(t *testing.T) {})
t.Run("dial failure emits error", func(t *testing.T) {})
t.Run("exits on stop", func(t *testing.T) {})
}