File tree Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Expand file tree Collapse file tree 1 file changed +12
-5
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,8 @@ const contextWaitTimeout = 5 * time.Second // how long to wait for
37
37
38
38
var (
39
39
ErrNoDatabaseName = fmt .Errorf ("no database name" )
40
- ErrNilConfig = fmt .Errorf ("no config" )
40
+ ErrNilConfig = fmt .Errorf ("no config" )
41
+ ErrTypoAndNotNonTypoUsed = fmt .Errorf ("both x-advisory-lock-timeout-interval and x-advisory-lock-timout-interval were specified" )
41
42
)
42
43
43
44
type Mongo struct {
@@ -138,11 +139,17 @@ func (m *Mongo) Open(dsn string) (database.Driver, error) {
138
139
return nil , err
139
140
}
140
141
141
- lockTimeout := unknown .Get ("x-advisory-lock-timeout-interval" )
142
+ lockTimeoutIntervalValue := unknown .Get ("x-advisory-lock-timeout-interval" )
143
+ // The initial release had a typo for this argument but for backwards compatibility sake, we will keep supporting it
144
+ // and we will error out if both values are set.
145
+ lockTimeoutIntervalValueFromTypo := unknown .Get ("x-advisory-lock-timout-interval" )
142
146
143
- if lockTimeout == "" {
144
- // The initial release had a typo for this argument but for backwards compatibility sake, we will keep supporting it.
145
- lockTimeout = unknown .Get ("x-advisory-lock-timout-interval" )
147
+ lockTimeout := lockTimeoutIntervalValue
148
+
149
+ if (lockTimeoutIntervalValue != "" && lockTimeoutIntervalValueFromTypo != "" ) {
150
+ return nil , ErrTypoAndNotNonTypoUsed
151
+ } else if (lockTimeoutIntervalValueFromTypo != "" ) {
152
+ lockTimeout = lockTimeoutIntervalValueFromTypo
146
153
}
147
154
148
155
maxLockCheckInterval , err := parseInt (lockTimeout , DefaultLockTimeoutInterval )
You can’t perform that action at this time.
0 commit comments