mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-08-01 13:52:46 +00:00
parent
201ac05943
commit
bd39748b5c
8 changed files with 131 additions and 143 deletions
|
@ -27,8 +27,6 @@ func IsUniqueConstraintViolationErr(err error) bool {
|
|||
switch e := err.(type) {
|
||||
case *pq.Error:
|
||||
return e.Code == "23505"
|
||||
case pq.Error:
|
||||
return e.Code == "23505"
|
||||
case *sqlite3.Error:
|
||||
return e.Code == sqlite3.ErrConstraint
|
||||
case sqlite3.Error:
|
||||
|
|
|
@ -57,7 +57,7 @@ func (w *ExclusiveWriter) Do(db *sql.DB, txn *sql.Tx, f func(txn *sql.Tx) error)
|
|||
// opened using the database object from the task and then this will
|
||||
// be passed as a parameter to the task function.
|
||||
func (w *ExclusiveWriter) run() {
|
||||
if !w.running.CAS(false, true) {
|
||||
if !w.running.CompareAndSwap(false, true) {
|
||||
return
|
||||
}
|
||||
if tracingEnabled {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue