@@ -121,8 +121,7 @@ func (w *waitingPod) GetPendingPlugins() []string {
121
121
// Allow declares the waiting pod is allowed to be scheduled by plugin pluginName.
122
122
// If this is the last remaining plugin to allow, then a success signal is delivered
123
123
// to unblock the pod.
124
- // Returns true if the allow signal was successfully dealt with, false otherwise.
125
- func (w * waitingPod ) Allow (pluginName string ) bool {
124
+ func (w * waitingPod ) Allow (pluginName string ) {
126
125
w .mu .Lock ()
127
126
defer w .mu .Unlock ()
128
127
if timer , exist := w .pendingPlugins [pluginName ]; exist {
@@ -132,30 +131,29 @@ func (w *waitingPod) Allow(pluginName string) bool {
132
131
133
132
// Only signal success status after all plugins have allowed
134
133
if len (w .pendingPlugins ) != 0 {
135
- return true
134
+ return
136
135
}
137
136
137
+ // The select clause works as a non-blocking send.
138
+ // If there is no receiver, it's a no-op (default case).
138
139
select {
139
140
case w .s <- NewStatus (Success , "" ):
140
- return true
141
141
default :
142
- return false
143
142
}
144
143
}
145
144
146
- // Reject declares the waiting pod unschedulable. Returns true if the reject signal
147
- // was successfully delivered, false otherwise.
148
- func (w * waitingPod ) Reject (msg string ) bool {
145
+ // Reject declares the waiting pod unschedulable.
146
+ func (w * waitingPod ) Reject (msg string ) {
149
147
w .mu .RLock ()
150
148
defer w .mu .RUnlock ()
151
149
for _ , timer := range w .pendingPlugins {
152
150
timer .Stop ()
153
151
}
154
152
153
+ // The select clause works as a non-blocking send.
154
+ // If there is no receiver, it's a no-op (default case).
155
155
select {
156
156
case w .s <- NewStatus (Unschedulable , msg ):
157
- return true
158
157
default :
159
- return false
160
158
}
161
159
}
0 commit comments