From eabb3a1b913586a891dff84352e0fb0f7c32166d Mon Sep 17 00:00:00 2001 From: Niels Hofmans Date: Mon, 23 Oct 2023 08:55:31 +0200 Subject: [PATCH 1/2] fix: do not skip one host during fetch --- pkg/falcon/extractor.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/pkg/falcon/extractor.go b/pkg/falcon/extractor.go index ab09838..ce3eccc 100644 --- a/pkg/falcon/extractor.go +++ b/pkg/falcon/extractor.go @@ -179,10 +179,12 @@ func GetMessages(config *config.Config, ctx context.Context) (results map[string allHostDetails := make([]*models.DomainDeviceSwagger, 0) step := 100 - sliceStart := 0 - sliceEnd := sliceStart + step - for { + for sliceStart := 0; sliceStart < len(hostResult.Payload.Resources); i += step { + sliceEnd := sliceStart + step + if sliceEnd > len(hostResult.Payload.Resources) { + sliceEnd = len(hostResult.Payload.Resources) + } if sliceEnd == len(hostResult.Payload.Resources)-1 { break From 94fb627c9e1457315320f64874b59dc924870e5a Mon Sep 17 00:00:00 2001 From: Niels Hofmans Date: Mon, 23 Oct 2023 09:01:30 +0200 Subject: [PATCH 2/2] fix: do not skip one host during fetch --- pkg/falcon/extractor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkg/falcon/extractor.go b/pkg/falcon/extractor.go index e005cc9..0a3be24 100644 --- a/pkg/falcon/extractor.go +++ b/pkg/falcon/extractor.go @@ -180,7 +180,7 @@ func GetMessages(config *config.Config, ctx context.Context) (results map[string step := 100 - for sliceStart := 0; sliceStart < len(hostResult.Payload.Resources); i += step { + for sliceStart := 0; sliceStart < len(hostResult.Payload.Resources); sliceStart += step { sliceEnd := sliceStart + step if sliceEnd > len(hostResult.Payload.Resources) { sliceEnd = len(hostResult.Payload.Resources)