~emersion/soju-dev

database: use postgresQueryTimeout for PostgresDB StoreMessages v1 APPLIED

sentriz: 1
 database: use postgresQueryTimeout for PostgresDB StoreMessages

 1 files changed, 1 insertions(+), 1 deletions(-)
Export patchset (mbox)
How do I use this?

Copy & paste the following snippet into your terminal to import this patchset into git:

curl -s https://lists.sr.ht/~emersion/soju-dev/patches/46439/mbox | git am -3
Learn more about email & git

[PATCH] database: use postgresQueryTimeout for PostgresDB StoreMessages Export this patch

using the sqliteQueryTimeout means a `undefined: sqliteQueryTimeout`
when building with `-tags=nosqlite`

---
 database/postgres.go | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/database/postgres.go b/database/postgres.go
index 68672a6..ca6bf51 100644
--- a/database/postgres.go
+++ b/database/postgres.go
@@ -933,7 +933,7 @@ func (db *PostgresDB) StoreMessages(ctx context.Context, networkID int64, name s
		return nil, nil
	}

	ctx, cancel := context.WithTimeout(ctx, time.Duration(len(msgs))*sqliteQueryTimeout)
	ctx, cancel := context.WithTimeout(ctx, time.Duration(len(msgs))*postgresQueryTimeout)
	defer cancel()

	tx, err := db.db.BeginTx(ctx, nil)
-- 
2.42.0
there seems to be no functional difference anyway, since we have 

    const postgresQueryTimeout = 5 * time.Second
    const sqliteQueryTimeout = 5 * time.Second
Pushed, thanks for the fix!