Skip to content

Commit

Permalink
api/auth: fix invalid mgo session
Browse files Browse the repository at this point in the history
This patch updates the outdated mgo package to the community version
github.com/globalsign/mgo to fix the issue that the mgo session cannot
be used after the primary node shutdown and re-elected.

Related issue: globalsign/mgo#5
  • Loading branch information
babygoat committed Jul 16, 2021
1 parent 6858bd3 commit 734e4a0
Show file tree
Hide file tree
Showing 4 changed files with 77 additions and 17 deletions.
2 changes: 1 addition & 1 deletion controllers/controller-factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,13 @@ import (

"github.com/twreporter/go-api/internal/news"

"github.com/globalsign/mgo"
"github.com/jinzhu/gorm"
"github.com/twreporter/go-api/globals"
"github.com/twreporter/go-api/services"
"github.com/twreporter/go-api/storage"
"github.com/twreporter/go-api/utils"
"go.mongodb.org/mongo-driver/mongo"
"gopkg.in/mgo.v2"
)

// ControllerFactory generates controlloers by given persistent storage connection
Expand Down
27 changes: 16 additions & 11 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ go 1.12

require (
cloud.google.com/go v0.52.0 // indirect
github.com/algolia/algoliasearch-client-go v2.25.0+incompatible
github.com/algolia/algoliasearch-client-go/v3 v3.16.0
github.com/auth0/go-jwt-middleware v0.0.0-20170425171159-5493cabe49f7
github.com/aws/aws-sdk-go v1.34.28
Expand All @@ -13,45 +12,51 @@ require (
github.com/dgrijalva/jwt-go v3.2.0+incompatible
github.com/erikstmartin/go-testdb v0.0.0-20160219214506-8d10e4a1bae5 // indirect
github.com/gin-contrib/cors v0.0.0-20170708080947-567de1916927
github.com/gin-contrib/sessions v0.0.0-20180827025425-58cbcf30135c
github.com/gin-gonic/gin v1.5.0
github.com/gin-contrib/sessions v0.0.3
github.com/gin-gonic/gin v1.7.2
github.com/globalsign/mgo v0.0.0-20181015135952-eeefdecb41b8
github.com/go-playground/universal-translator v0.17.0 // indirect
github.com/go-playground/validator/v10 v10.7.0 // indirect
github.com/go-sql-driver/mysql v1.5.0
github.com/gofrs/uuid v3.2.0+incompatible // indirect
github.com/golang-migrate/migrate/v4 v4.6.1
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/uuid v1.1.1
github.com/gorilla/mux v1.7.2 // indirect
github.com/gorilla/sessions v1.1.1 // indirect
github.com/gorilla/sessions v1.2.1 // indirect
github.com/jinzhu/copier v0.0.0-20180308034124-7e38e58719c3
github.com/jinzhu/gorm v1.9.2
github.com/jinzhu/inflection v0.0.0-20170102125226-1c35d901db3d // indirect
github.com/jinzhu/now v1.0.1 // indirect
github.com/json-iterator/go v1.1.9 // indirect
github.com/kidstuff/mongostore v0.0.0-20180412085134-db2a8b4fac1f // indirect
github.com/json-iterator/go v1.1.11 // indirect
github.com/kr/pretty v0.2.0 // indirect
github.com/leodido/go-urn v1.2.0 // indirect
github.com/leodido/go-urn v1.2.1 // indirect
github.com/lib/pq v1.1.1 // indirect
github.com/matryer/try v0.0.0-20161228173917-9ac251b645a2 // indirect
github.com/mattn/go-isatty v0.0.12 // indirect
github.com/mattn/go-isatty v0.0.13 // indirect
github.com/pkg/errors v0.9.1
github.com/sirupsen/logrus v1.4.2
github.com/smartystreets/goconvey v0.0.0-20190330032615-68dc04aab96a // indirect
github.com/spf13/viper v1.3.2
github.com/stretchr/testify v1.6.1
github.com/twreporter/logformatter v0.0.0-20200211094126-60fe42618206
github.com/ugorji/go v1.2.6 // indirect
go.mongodb.org/mongo-driver v1.4.6
golang.org/x/crypto v0.0.0-20200210222208-86ce3cb69678
golang.org/x/crypto v0.0.0-20210711020723-a769d52b0f97
golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d
golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 // indirect
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect
golang.org/x/text v0.3.6 // indirect
golang.org/x/time v0.0.0-20191024005414-555d28b269f0 // indirect
google.golang.org/genproto v0.0.0-20200211035748-55294c81d784 // indirect
google.golang.org/grpc v1.27.1 // indirect
google.golang.org/protobuf v1.27.1 // indirect
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 // indirect
gopkg.in/go-playground/validator.v8 v8.18.2
gopkg.in/go-playground/validator.v9 v9.31.0 // indirect
gopkg.in/guregu/null.v3 v3.4.0
gopkg.in/matryer/try.v1 v1.0.0-20150601225556-312d2599e12e
gopkg.in/mgo.v2 v2.0.0-20160818020120-3f83fa500528
gopkg.in/mgo.v2 v2.0.0-20190816093944-a6b53ec6cb22
gopkg.in/yaml.v2 v2.4.0 // indirect
)

replace (
Expand Down
Loading

0 comments on commit 734e4a0

Please sign in to comment.