mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-02 02:52:25 -06:00
Update dependencies (#333)
This commit is contained in:
parent
ce22e03f9d
commit
182b4eea73
848 changed files with 377869 additions and 107280 deletions
7
vendor/github.com/jackc/pgconn/CHANGELOG.md
generated
vendored
7
vendor/github.com/jackc/pgconn/CHANGELOG.md
generated
vendored
|
|
@ -1,3 +1,10 @@
|
|||
# 1.10.1 (November 20, 2021)
|
||||
|
||||
* Close without waiting for response (Kei Kamikawa)
|
||||
* Save waiting for network round-trip in CopyFrom (Rueian)
|
||||
* Fix concurrency issue with ContextWatcher
|
||||
* LRU.Get always checks context for cancellation / expiration (Georges Varouchas)
|
||||
|
||||
# 1.10.0 (July 24, 2021)
|
||||
|
||||
* net.Timeout errors are no longer returned when a query is canceled via context. A wrapped context error is returned.
|
||||
|
|
|
|||
13
vendor/github.com/jackc/pgconn/internal/ctxwatch/context_watcher.go
generated
vendored
13
vendor/github.com/jackc/pgconn/internal/ctxwatch/context_watcher.go
generated
vendored
|
|
@ -2,6 +2,7 @@ package ctxwatch
|
|||
|
||||
import (
|
||||
"context"
|
||||
"sync"
|
||||
)
|
||||
|
||||
// ContextWatcher watches a context and performs an action when the context is canceled. It can watch one context at a
|
||||
|
|
@ -10,8 +11,10 @@ type ContextWatcher struct {
|
|||
onCancel func()
|
||||
onUnwatchAfterCancel func()
|
||||
unwatchChan chan struct{}
|
||||
watchInProgress bool
|
||||
onCancelWasCalled bool
|
||||
|
||||
lock sync.Mutex
|
||||
watchInProgress bool
|
||||
onCancelWasCalled bool
|
||||
}
|
||||
|
||||
// NewContextWatcher returns a ContextWatcher. onCancel will be called when a watched context is canceled.
|
||||
|
|
@ -29,6 +32,9 @@ func NewContextWatcher(onCancel func(), onUnwatchAfterCancel func()) *ContextWat
|
|||
|
||||
// Watch starts watching ctx. If ctx is canceled then the onCancel function passed to NewContextWatcher will be called.
|
||||
func (cw *ContextWatcher) Watch(ctx context.Context) {
|
||||
cw.lock.Lock()
|
||||
defer cw.lock.Unlock()
|
||||
|
||||
if cw.watchInProgress {
|
||||
panic("Watch already in progress")
|
||||
}
|
||||
|
|
@ -54,6 +60,9 @@ func (cw *ContextWatcher) Watch(ctx context.Context) {
|
|||
// Unwatch stops watching the previously watched context. If the onCancel function passed to NewContextWatcher was
|
||||
// called then onUnwatchAfterCancel will also be called.
|
||||
func (cw *ContextWatcher) Unwatch() {
|
||||
cw.lock.Lock()
|
||||
defer cw.lock.Unlock()
|
||||
|
||||
if cw.watchInProgress {
|
||||
cw.unwatchChan <- struct{}{}
|
||||
if cw.onCancelWasCalled {
|
||||
|
|
|
|||
25
vendor/github.com/jackc/pgconn/pgconn.go
generated
vendored
25
vendor/github.com/jackc/pgconn/pgconn.go
generated
vendored
|
|
@ -578,7 +578,6 @@ func (pgConn *PgConn) Close(ctx context.Context) error {
|
|||
//
|
||||
// See https://github.com/jackc/pgx/issues/637
|
||||
pgConn.conn.Write([]byte{'X', 0, 0, 0, 4})
|
||||
pgConn.conn.Read(make([]byte, 1))
|
||||
|
||||
return pgConn.conn.Close()
|
||||
}
|
||||
|
|
@ -605,7 +604,6 @@ func (pgConn *PgConn) asyncClose() {
|
|||
pgConn.conn.SetDeadline(deadline)
|
||||
|
||||
pgConn.conn.Write([]byte{'X', 0, 0, 0, 4})
|
||||
pgConn.conn.Read(make([]byte, 1))
|
||||
}()
|
||||
}
|
||||
|
||||
|
|
@ -1187,27 +1185,6 @@ func (pgConn *PgConn) CopyFrom(ctx context.Context, r io.Reader, sql string) (Co
|
|||
return nil, &writeError{err: err, safeToRetry: n == 0}
|
||||
}
|
||||
|
||||
// Read until copy in response or error.
|
||||
var commandTag CommandTag
|
||||
var pgErr error
|
||||
pendingCopyInResponse := true
|
||||
for pendingCopyInResponse {
|
||||
msg, err := pgConn.receiveMessage()
|
||||
if err != nil {
|
||||
pgConn.asyncClose()
|
||||
return nil, preferContextOverNetTimeoutError(ctx, err)
|
||||
}
|
||||
|
||||
switch msg := msg.(type) {
|
||||
case *pgproto3.CopyInResponse:
|
||||
pendingCopyInResponse = false
|
||||
case *pgproto3.ErrorResponse:
|
||||
pgErr = ErrorResponseToPgError(msg)
|
||||
case *pgproto3.ReadyForQuery:
|
||||
return commandTag, pgErr
|
||||
}
|
||||
}
|
||||
|
||||
// Send copy data
|
||||
abortCopyChan := make(chan struct{})
|
||||
copyErrChan := make(chan error, 1)
|
||||
|
|
@ -1246,6 +1223,7 @@ func (pgConn *PgConn) CopyFrom(ctx context.Context, r io.Reader, sql string) (Co
|
|||
}
|
||||
}()
|
||||
|
||||
var pgErr error
|
||||
var copyErr error
|
||||
for copyErr == nil && pgErr == nil {
|
||||
select {
|
||||
|
|
@ -1282,6 +1260,7 @@ func (pgConn *PgConn) CopyFrom(ctx context.Context, r io.Reader, sql string) (Co
|
|||
}
|
||||
|
||||
// Read results
|
||||
var commandTag CommandTag
|
||||
for {
|
||||
msg, err := pgConn.receiveMessage()
|
||||
if err != nil {
|
||||
|
|
|
|||
8
vendor/github.com/jackc/pgconn/stmtcache/lru.go
generated
vendored
8
vendor/github.com/jackc/pgconn/stmtcache/lru.go
generated
vendored
|
|
@ -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 {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue