summaryrefslogtreecommitdiff
path: root/vendor/google.golang.org/grpc/picker_wrapper.go
diff options
context:
space:
mode:
authorLibravatar Daenney <daenney@users.noreply.github.com>2024-03-11 15:34:34 +0100
committerLibravatar GitHub <noreply@github.com>2024-03-11 15:34:34 +0100
commit5e871e81a87a638b07d540c15d1b95608843255d (patch)
tree62db65c7de651bac3d8894f4f70e0fe8de853a5e /vendor/google.golang.org/grpc/picker_wrapper.go
parent[chore]: Bump github.com/minio/minio-go/v7 from 7.0.67 to 7.0.69 (#2748) (diff)
downloadgotosocial-5e871e81a87a638b07d540c15d1b95608843255d.tar.xz
[chore] Update usage of OTEL libraries (#2725)
* otel to 1.24 * prometheus exporter to 0.46 * bunotel to 1.1.17 Also: * Use schemaless URL for metrics * Add software version to tracing schema
Diffstat (limited to 'vendor/google.golang.org/grpc/picker_wrapper.go')
-rw-r--r--vendor/google.golang.org/grpc/picker_wrapper.go21
1 files changed, 4 insertions, 17 deletions
diff --git a/vendor/google.golang.org/grpc/picker_wrapper.go b/vendor/google.golang.org/grpc/picker_wrapper.go
index 236837f41..bf56faa76 100644
--- a/vendor/google.golang.org/grpc/picker_wrapper.go
+++ b/vendor/google.golang.org/grpc/picker_wrapper.go
@@ -37,7 +37,6 @@ import (
type pickerWrapper struct {
mu sync.Mutex
done bool
- idle bool
blockingCh chan struct{}
picker balancer.Picker
statsHandlers []stats.Handler // to record blocking picker calls
@@ -53,11 +52,7 @@ func newPickerWrapper(statsHandlers []stats.Handler) *pickerWrapper {
// updatePicker is called by UpdateBalancerState. It unblocks all blocked pick.
func (pw *pickerWrapper) updatePicker(p balancer.Picker) {
pw.mu.Lock()
- if pw.done || pw.idle {
- // There is a small window where a picker update from the LB policy can
- // race with the channel going to idle mode. If the picker is idle here,
- // it is because the channel asked it to do so, and therefore it is sage
- // to ignore the update from the LB policy.
+ if pw.done {
pw.mu.Unlock()
return
}
@@ -210,23 +205,15 @@ func (pw *pickerWrapper) close() {
close(pw.blockingCh)
}
-func (pw *pickerWrapper) enterIdleMode() {
- pw.mu.Lock()
- defer pw.mu.Unlock()
- if pw.done {
- return
- }
- pw.idle = true
-}
-
-func (pw *pickerWrapper) exitIdleMode() {
+// reset clears the pickerWrapper and prepares it for being used again when idle
+// mode is exited.
+func (pw *pickerWrapper) reset() {
pw.mu.Lock()
defer pw.mu.Unlock()
if pw.done {
return
}
pw.blockingCh = make(chan struct{})
- pw.idle = false
}
// dropError is a wrapper error that indicates the LB policy wishes to drop the