File tree Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Expand file tree Collapse file tree 1 file changed +10
-6
lines changed Original file line number Diff line number Diff line change @@ -98,7 +98,14 @@ func (r *Router) doSelection() {
9898 select {
9999 case _ = <- r .theConch :
100100 r .selectionInProgress .Lock ()
101- defer r .selectionInProgress .Unlock ()
101+ defer func () {
102+ r .selectionInProgress .Unlock ()
103+ if log .GetLevel () >= log .DebugLevel {
104+ log .Debugf ("Returning selection lock" )
105+ }
106+ r .theConch <- struct {}{}
107+ }()
108+
102109 if log .GetLevel () >= log .DebugLevel {
103110 log .Debugf ("Got selection lock; performing selection" )
104111 }
@@ -138,14 +145,11 @@ func (r *Router) doSelection() {
138145
139146 r .metrics .selectedBackends .Set (float64 (len (result .Selection )))
140147 r .metrics .selectionEvents .Inc ()
141- if log .GetLevel () >= log .DebugLevel {
142- log .Debugf ("Returning selection lock" )
143- }
144- r .theConch <- struct {}{}
148+
145149 default :
146150 log .Warnf ("Selection is already in-progress; awaiting result" )
147151 r .selectionInProgress .RLock ()
148- defer r .selectionInProgress .RUnlock ()
152+ r .selectionInProgress .RUnlock ()
149153 }
150154}
151155
You can’t perform that action at this time.
0 commit comments