summaryrefslogtreecommitdiff
path: root/vendor/github.com/jackc/pgconn/stmtcache
diff options
context:
space:
mode:
authorLibravatar tobi <31960611+tsmethurst@users.noreply.github.com>2021-11-27 15:26:58 +0100
committerLibravatar GitHub <noreply@github.com>2021-11-27 15:26:58 +0100
commit182b4eea73881c611a0f519576aa6ad2aa6799c2 (patch)
tree230fac469690fcee8797b13585e739be148d4789 /vendor/github.com/jackc/pgconn/stmtcache
parentRequire confirmed email when checking oauth token (#332) (diff)
downloadgotosocial-182b4eea73881c611a0f519576aa6ad2aa6799c2.tar.xz
Update dependencies (#333)
Diffstat (limited to 'vendor/github.com/jackc/pgconn/stmtcache')
-rw-r--r--vendor/github.com/jackc/pgconn/stmtcache/lru.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/vendor/github.com/jackc/pgconn/stmtcache/lru.go b/vendor/github.com/jackc/pgconn/stmtcache/lru.go
index f58f2ac34..90fb76c2f 100644
--- a/vendor/github.com/jackc/pgconn/stmtcache/lru.go
+++ b/vendor/github.com/jackc/pgconn/stmtcache/lru.go
@@ -42,6 +42,14 @@ func NewLRU(conn *pgconn.PgConn, mode int, cap int) *LRU {
// Get returns the prepared statement description for sql preparing or describing the sql on the server as needed.
func (c *LRU) Get(ctx context.Context, sql string) (*pgconn.StatementDescription, error) {
+ if ctx != context.Background() {
+ select {
+ case <-ctx.Done():
+ return nil, ctx.Err()
+ default:
+ }
+ }
+
// flush an outstanding bad statements
txStatus := c.conn.TxStatus()
if (txStatus == 'I' || txStatus == 'T') && len(c.stmtsToClear) > 0 {