From 903a06a1600036bc70e0f14c640b1935a7246e0f Mon Sep 17 00:00:00 2001 From: Konstantin Lebedev <9497591+kmlebedev@users.noreply.github.com> Date: Tue, 30 Aug 2022 12:02:09 +0500 Subject: [PATCH] avoid data race access to startDelay (#3548) --- weed/command/filer.go | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/weed/command/filer.go b/weed/command/filer.go index 5c1e653cb..0dd35e5bd 100644 --- a/weed/command/filer.go +++ b/weed/command/filer.go @@ -173,29 +173,29 @@ func runFiler(cmd *Command, args []string) bool { if *f.dataCenter != "" && *filerS3Options.dataCenter == "" { filerS3Options.dataCenter = f.dataCenter } - go func() { - time.Sleep(startDelay * time.Second) + go func(delay time.Duration) { + time.Sleep(delay * time.Second) filerS3Options.startS3Server() - }() + }(startDelay) startDelay++ } if *filerStartWebDav { filerWebDavOptions.filer = &filerAddress - go func() { - time.Sleep(startDelay * time.Second) + go func(delay time.Duration) { + time.Sleep(delay * time.Second) filerWebDavOptions.startWebDav() - }() + }(startDelay) startDelay++ } if *filerStartIam { filerIamOptions.filer = &filerAddress filerIamOptions.masters = f.mastersString - go func() { - time.Sleep(startDelay * time.Second) + go func(delay time.Duration) { + time.Sleep(delay * time.Second) filerIamOptions.startIamServer() - }() + }(startDelay) } f.masters = pb.ServerAddresses(*f.mastersString).ToAddressMap()