feat: editor write path

This commit is contained in:
Florian Sylvain committed 2026-11-02 03:24:30 +01:00
1 parent d9158025d4
commit a0b3c58c52
88 files changed
+5738 -263

No files matched your search

@@ -7,6 +7,7 @@ import (
"net"
"net/url"
"reflect"
"slices"
"time"
"github.com/jackc/pgx/v5/pgconn"
@@ -23,6 +24,8 @@ const (
postgresUTCCallback = "renewcms:postgres_utc"
gormQueryCallback = "gorm:query"
postgresLockNotAvailable = "55P03"
postgresDeadlockDetected = "40P01"
postgresSerializationFailure = "40001"
)
var timeType = reflect.TypeOf(time.Time{})
@@ -109,7 +112,9 @@ func (postgresDriver) NewBackup(db *gorm.DB, directory string, now func() time.T
return NewPostgresBackup(db, directory, now)
}
var postgresContentionCodes = []string{postgresLockNotAvailable, postgresDeadlockDetected, postgresSerializationFailure}
func (postgresDriver) IsLockContention(err error) bool {
var failure *pgconn.PgError
return errors.As(err, &failure) && failure.Code == postgresLockNotAvailable
return errors.As(err, &failure) && slices.Contains(postgresContentionCodes, failure.Code)
}