diff --git a/.github/workflows/golangci-lint.yml b/.github/workflows/golangci-lint.yml index e62eb8d0..c759321f 100644 --- a/.github/workflows/golangci-lint.yml +++ b/.github/workflows/golangci-lint.yml @@ -1,4 +1,4 @@ -name: Golangci Lint Check +name: Golangci-Lint Check on: push: @@ -32,7 +32,7 @@ jobs: DIRECTORIES=$(find . -type d -not -path '*/\.*' | jq -R -s -c 'split("\n")[:-1]') echo "matrix=${DIRECTORIES}" >> $GITHUB_OUTPUT - golangci-lint: + lint: needs: generate-matrix runs-on: ubuntu-latest strategy: diff --git a/mongodb/mongodb.go b/mongodb/mongodb.go index d4c359bb..a42fbbe9 100644 --- a/mongodb/mongodb.go +++ b/mongodb/mongodb.go @@ -53,11 +53,13 @@ func New(config ...Config) *Storage { } // Set mongo options - opt := options.Client() - opt.ApplyURI(dsn) + opt := options.Client().ApplyURI(dsn) - // Create mongo client - client, err := mongo.NewClient(opt) + // Create and connect the mongo client in one step + ctx, cancel := context.WithTimeout(context.Background(), 20*time.Second) + defer cancel() + + client, err := mongo.Connect(ctx, opt) if err != nil { panic(err) }