Skip to content

Commit

Permalink
fix empty subslice removal
Browse files Browse the repository at this point in the history
  • Loading branch information
prateekchaudhry committed May 30, 2023
1 parent 3ed1ec2 commit 098ee63
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion agent/engine/host_resource_manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ func (h *HostResourceManager) checkResourcesHealth(resources map[string]*ecs.Res
for resourceKey, resourceVal := range resources {
_, ok := h.initialHostResource[resourceKey]
if !ok {
logger.Error(fmt.Sprintf("resource %s not found in ", resourceKey))
logger.Error(fmt.Sprintf("resource %s not found in %s", resourceKey))
return &InvalidHostResource{resourceKey}
}

Expand Down Expand Up @@ -266,6 +266,9 @@ func (h *HostResourceManager) consumable(resources map[string]*ecs.Resource) (bo
func removeSubSlice(s1 []*string, s2 []*string) []*string {
begin := 0
end := len(s1) - 1
if len(s2) == 0 {
return s1
}
for ; begin < len(s1); begin++ {
if *s1[begin] == *s2[0] {
break
Expand Down

0 comments on commit 098ee63

Please sign in to comment.