fix(scheduler): ignore classmetadata check when it is nil

This commit is contained in:
rainzm
2022-03-02 17:26:49 +08:00
parent 59c32ff7d6
commit ff02e8c3ea
@@ -132,6 +132,9 @@ func (p *ClassMetadataPredicate) Execute(u *core.Unit, c core.Candidater) (bool,
h := NewPredicateHelper(p, u, c)
ctx := context.Background()
for _, resource := range []*ResourceWithClassMetadata{p.tenant, p.guestSource} {
if resource == nil {
continue
}
ic, err := db.IsInSameClass(ctx, c.Getter(), resource)
if err != nil {
return false, nil, errors.Wrap(err, "unable to determine whether they are in a class")