Skip to content

Commit

Permalink
Fix invocation of deferred function for loading schema.
Browse files Browse the repository at this point in the history
Golang's defer's arguments are evaluated immediately. Thus the time.Since(start) was being resolved immediately, rather than at the end of function execution.

Signed-off-by: dleibovic <[email protected]>
  • Loading branch information
dasl- committed Oct 8, 2019
1 parent 2c8664c commit a851d7b
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion go/vt/vttablet/tabletserver/schema/engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (se *Engine) Open() error {
return nil
}
start := time.Now()
defer log.Infof("Time taken to load the schema: %v", time.Since(start))
defer func() { log.Infof("Time taken to load the schema: %v", time.Since(start)) }()
ctx := tabletenv.LocalContext()
dbaParams := se.dbconfigs.DbaWithDB()
se.conns.Open(dbaParams, dbaParams, dbaParams)
Expand Down

0 comments on commit a851d7b

Please sign in to comment.