From 233b0b4f790bf2ee10e0038a11eafd40b9d670b9 Mon Sep 17 00:00:00 2001 From: Ivan Milchev Date: Thu, 7 Sep 2023 21:56:15 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20make=20sure=20providers=20are=20?= =?UTF-8?q?not=20killed=20after=20an=20asset=20is=20scanned=20(#1663)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This makes sure that scans for a list of assets work. The current implementation would kill the provider after the first asset is scanned. We do a simple fix here that will only kill open providers after the whole scan is complete. As a long term fix we should probably look into keeping track of assets that need a specific provider. Only when all assets for the provider have been scanned, it can be killed. Signed-off-by: Ivan Milchev --- explorer/scan/local_scanner.go | 1 + providers/runtime.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/explorer/scan/local_scanner.go b/explorer/scan/local_scanner.go index e7ab34aeb4..139a78464e 100644 --- a/explorer/scan/local_scanner.go +++ b/explorer/scan/local_scanner.go @@ -312,6 +312,7 @@ func (s *LocalScanner) distributeJob(job *Job, ctx context.Context, upstream *up multiprogress.Open() }() scanGroup.Wait() + providers.Coordinator.Shutdown() return reporter.Reports(), finished, nil } diff --git a/providers/runtime.go b/providers/runtime.go index 5d35fbaafb..8b23f69800 100644 --- a/providers/runtime.go +++ b/providers/runtime.go @@ -69,7 +69,8 @@ func (r *Runtime) Close() { log.Error().Err(err).Msg("failed to save recording") } - r.coordinator.Close(r.Provider.Instance) + // TODO: ideally, we try to close the provider here but only if there are no more assets that need it + // r.coordinator.Close(r.Provider.Instance) r.schema.Close() }