Skip to content

Commit

Permalink
conn: dont propogate context cancelled in prepare (apache#1368)
Browse files Browse the repository at this point in the history
* conn: dont propogate context cancelled in prepare

If a callers context is cancelled and they won the race to prepare a
statement, dont stop the prepare and fail it with context failed error
as other callers may be waiting for us to finish.

Achieve this by replacing the waitgroup used to wait for prepared to
finish with a channel which is closed by the preparer. Do the preparing
in a goroutine and use context.Background in the exec call so that the
prepare will always finish. All callers now use the same flow to wait
for the result of the prepare waiting against their own context so they
can bail out individually.

fixes apache#1341

* ensure closing a connection kills inflight prepares
  • Loading branch information
Zariel authored Nov 6, 2019
1 parent 9faa4c0 commit ae2f7fc
Show file tree
Hide file tree
Showing 5 changed files with 139 additions and 122 deletions.
Loading

0 comments on commit ae2f7fc

Please sign in to comment.