From 7db5b473bb4d44654e718de26e1dd5935befe4fa Mon Sep 17 00:00:00 2001 From: Agniva De Sarker Date: Thu, 17 Aug 2023 19:49:40 +0530 Subject: [PATCH] MM-54158: S3PathMigration: Re-initialize stop chan (#24286) This got missed out in the initial PR review. There's been only one instance of this, and that too in a spinwick so it's not widepsread. We will cp this if we see more crashes. https://mattermost.atlassian.net/browse/MM-54158 ```release-note NONE ``` --- server/channels/jobs/s3_path_migration/s3_path_migration.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/server/channels/jobs/s3_path_migration/s3_path_migration.go b/server/channels/jobs/s3_path_migration/s3_path_migration.go index 1157b7646e8..203c3797262 100644 --- a/server/channels/jobs/s3_path_migration/s3_path_migration.go +++ b/server/channels/jobs/s3_path_migration/s3_path_migration.go @@ -52,6 +52,9 @@ func MakeWorker(jobServer *jobs.JobServer, store store.Store, fileBackend filest func (worker *S3PathMigrationWorker) Run() { mlog.Debug("Worker started", mlog.String("worker", worker.name)) + // We have to re-assign the stop channel again, because + // it might happen that the job was restarted due to a config change. + worker.stop = make(chan bool, 1) defer func() { mlog.Debug("Worker finished", mlog.String("worker", worker.name))