Skip to content

Commit 6511480

Browse files
authored
remove unnecessary mutex in RunMigrations func (#459)
1 parent 0ae111a commit 6511480

File tree

1 file changed

+0
-5
lines changed

1 file changed

+0
-5
lines changed

database/migrator.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import (
88
"database/sql"
99
"fmt"
1010
"io/fs"
11-
"sync"
1211
"time"
1312

1413
"github.com/moov-io/base/log"
@@ -25,8 +24,6 @@ import (
2524
"go.opentelemetry.io/otel/trace"
2625
)
2726

28-
var migrationMutex sync.Mutex
29-
3027
func RunMigrations(logger log.Logger, config DatabaseConfig, opts ...MigrateOption) error {
3128
return RunMigrationsContext(context.Background(), logger, config, opts...)
3229
}
@@ -53,7 +50,6 @@ func RunMigrationsContext(ctx context.Context, logger log.Logger, config Databas
5350
}
5451
defer driver.Close()
5552

56-
migrationMutex.Lock()
5753
m, err := migrate.NewWithInstance(
5854
source.name,
5955
source,
@@ -80,7 +76,6 @@ func RunMigrationsContext(ctx context.Context, logger log.Logger, config Databas
8076
span.SetAttributes(attribute.Int64("db.previous_version", int64(previousVersion))) //nolint:gosec
8177

8278
err = m.Up()
83-
migrationMutex.Unlock()
8479

8580
switch err {
8681
case nil:

0 commit comments

Comments
 (0)