Graceful shutdown blocks on running proxy handler connections (#2789)

This commit is contained in:
Todd authored and GitHub committed 2023-01-17 08:54:01 -08:00
1 parent a437bdae0a
commit bc409bc7d4
9 files changed
+129 -28

No files matched your search

+8
View File
@@ -48,6 +48,7 @@ type options struct {
withActiveWorkers bool
withFeature version.Feature
withDirectlyConnected bool
withWorkerPool []string
}
func getDefaultOptions() options {
@@ -238,3 +239,10 @@ func WithDirectlyConnected(conn bool) Option {
o.withDirectlyConnected = conn
}
}
// WithWorkerPool provides a slice of worker ids.
func WithWorkerPool(workerIds []string) Option {
return func(o *options) {
o.withWorkerPool = workerIds
}
}
+8
View File
@@ -225,4 +225,12 @@ func Test_GetOpts(t *testing.T) {
testOpts.withNewIdFunc = nil
assert.Equal(t, opts, testOpts)
})
t.Run("WithWorkerPool", func(t *testing.T) {
opts := GetOpts(WithWorkerPool([]string{"1", "2", "3"}))
testOpts := getDefaultOptions()
testOpts.withWorkerPool = []string{"1", "2", "3"}
opts.withNewIdFunc = nil
testOpts.withNewIdFunc = nil
assert.Equal(t, opts, testOpts)
})
}