Skip to content

Commit

Permalink
Handle stmtCache.Get error previously thought impossible
Browse files Browse the repository at this point in the history
The statement cache is already prefilled, but it is possible for the
ctx to be canceled between when the statement is prepared and when the
statement is retrieved for use.

refs #1156
  • Loading branch information
jackc committed Feb 19, 2022
1 parent 3650fc9 commit 1e565b0
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -773,8 +773,7 @@ func (c *Conn) SendBatch(ctx context.Context, b *Batch) BatchResults {
var err error
sd, err = stmtCache.Get(ctx, bi.query)
if err != nil {
// the stmtCache was prefilled from distinctUnpreparedQueries above so we are guaranteed no errors
panic("BUG: unexpected error from stmtCache")
return &batchResults{ctx: ctx, conn: c, err: err}
}
}

Expand Down

0 comments on commit 1e565b0

Please sign in to comment.