Skip to content
This repository was archived by the owner on Jun 12, 2018. It is now read-only.

Commit e0772d1

Browse files
author
Tim Vaillancourt
committed
Move defer on session to be before auth
1 parent 00123c5 commit e0772d1

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

cmd/flashback/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,6 +304,7 @@ func main() {
304304
session, err := mgo.DialWithInfo(dialInfo)
305305
panicOnError(err)
306306
session.SetSocketTimeout(time.Duration(socketTimeout))
307+
defer session.Close()
307308
if dialInfo.Username != "" && dialInfo.Password != "" {
308309
credentials := &mgo.Credential{
309310
Username: dialInfo.Username,
@@ -316,7 +317,6 @@ func main() {
316317
err = session.Login(credentials)
317318
panicOnError(err)
318319
}
319-
defer session.Close()
320320
workerStates[i] = nodeWorkerState{
321321
n.name,
322322
session,

0 commit comments

Comments
 (0)