From 86beb8fcb47ef1aea240ebfd95d91e07a9d6e700 Mon Sep 17 00:00:00 2001 From: Adrien CABARBAYE Date: Thu, 14 Aug 2025 10:46:24 +0100 Subject: [PATCH] :bug: [parallelisation] Make sure options are not overridden for a close store --- changes/20250814104556.bugfix | 1 + utils/parallelisation/onclose.go | 8 ++++---- 2 files changed, 5 insertions(+), 4 deletions(-) create mode 100644 changes/20250814104556.bugfix diff --git a/changes/20250814104556.bugfix b/changes/20250814104556.bugfix new file mode 100644 index 0000000000..8d642f16e2 --- /dev/null +++ b/changes/20250814104556.bugfix @@ -0,0 +1 @@ +:bug: [parallelisation] Make sure options are not overridden for a close store diff --git a/utils/parallelisation/onclose.go b/utils/parallelisation/onclose.go index 5f3d3fa37a..78142d8302 100644 --- a/utils/parallelisation/onclose.go +++ b/utils/parallelisation/onclose.go @@ -29,7 +29,7 @@ func NewCloserStore(stopOnFirstError bool) *CloserStore { if stopOnFirstError { option = StopOnFirstError } - return NewCloserStoreWithOptions(option, Parallel) + return NewCloserStoreWithOptions(option, Parallel, RetainAfterExecution) } // NewCloserStoreWithOptions returns a store of io.Closer object which will all be closed on Close(). The first error received if any will be returned @@ -40,7 +40,7 @@ func NewCloserStoreWithOptions(opts ...StoreOption) *CloserStore { return commonerrors.UndefinedVariable("closer object") } return closerObj.Close() - }, append(opts, RetainAfterExecution)...), + }, opts...), } } @@ -125,7 +125,7 @@ func NewCloseFunctionStore(options ...StoreOption) *CloseFunctionStore { return &CloseFunctionStore{ store: *newFunctionStore[CloseFunc](func(_ context.Context, closerObj CloseFunc) error { return closerObj() - }, append(options, RetainAfterExecution)...), + }, options...), } } @@ -141,5 +141,5 @@ func NewConcurrentCloseFunctionStore(stopOnFirstError bool) *CloseFunctionStore if stopOnFirstError { option = StopOnFirstError } - return NewCloseFunctionStore(option, Parallel) + return NewCloseFunctionStore(option, Parallel, RetainAfterExecution) }