Check nodeInfo before ecache
This commit is contained in:
@@ -17,6 +17,7 @@ limitations under the License.
|
|||||||
package core
|
package core
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"fmt"
|
||||||
"hash/fnv"
|
"hash/fnv"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
@@ -86,6 +87,12 @@ func (ec *EquivalenceCache) RunPredicate(
|
|||||||
) (bool, []algorithm.PredicateFailureReason, error) {
|
) (bool, []algorithm.PredicateFailureReason, error) {
|
||||||
ec.mu.Lock()
|
ec.mu.Lock()
|
||||||
defer ec.mu.Unlock()
|
defer ec.mu.Unlock()
|
||||||
|
|
||||||
|
if nodeInfo == nil || nodeInfo.Node() == nil {
|
||||||
|
// This may happen during tests.
|
||||||
|
return false, []algorithm.PredicateFailureReason{}, fmt.Errorf("nodeInfo is nil or node is invalid")
|
||||||
|
}
|
||||||
|
|
||||||
fit, reasons, invalid := ec.lookupResult(pod.GetName(), nodeInfo.Node().GetName(), predicateKey, equivClassInfo.hash)
|
fit, reasons, invalid := ec.lookupResult(pod.GetName(), nodeInfo.Node().GetName(), predicateKey, equivClassInfo.hash)
|
||||||
if !invalid {
|
if !invalid {
|
||||||
return fit, reasons, nil
|
return fit, reasons, nil
|
||||||
|
Reference in New Issue
Block a user