mirror of
https://github.com/jackc/pgx.git
synced 2025-05-31 11:42:24 +00:00
have lru.Get() always check if context is already expired
This commit is contained in:
parent
141f132ae7
commit
cd7dcd5802
@ -53,6 +53,14 @@ func (c *LRU) Get(ctx context.Context, sql string) (*pgconn.StatementDescription
|
||||
}
|
||||
}
|
||||
|
||||
if ctx != context.Background() {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
return nil, ctx.Err()
|
||||
default:
|
||||
}
|
||||
}
|
||||
|
||||
if el, ok := c.m[sql]; ok {
|
||||
c.l.MoveToFront(el)
|
||||
return el.Value.(*pgconn.StatementDescription), nil
|
||||
|
Loading…
x
Reference in New Issue
Block a user