storagenode/gracefulexit: Wait for the worker delete and transfer goroutines to finish before completing the exit

A failed test showed the same piece being deleted twice. This happens if the graceful exit completes before a previous piece deletion finishes. This change adds a "wait" on the limiter before executing the delete all step when GE is done.

Change-Id: I1c8c49d1e501c2728c80d4224a4854e742be27da
This commit is contained in:
Ethan 2020-08-18 17:08:53 -04:00 committed by Ethan Adams
parent 7f8df74070
commit 5445d595c0

View File

@ -153,6 +153,10 @@ func (worker *Worker) Run(ctx context.Context, done func()) (err error) {
if err != nil {
return errs.Wrap(err)
}
// wait for deletes to complete
worker.limiter.Wait()
// delete all remaining pieces
err = worker.deleteAllPieces(ctx)
if err != nil {