mirror of
https://github.com/zitadel/zitadel.git
synced 2025-12-05 06:32:06 +00:00
fix: fix and improve primary keys on projections (#3708)
* fix: org_domain projection * fix: projection reset * fix test * improve foreign keys on suffixed tables
This commit is contained in:
@@ -15,10 +15,9 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
lockStmtFormat = "INSERT INTO %[1]s" +
|
||||
" (locker_id, locked_until, projection_name) VALUES ($1, now()+$2::INTERVAL, $3)" +
|
||||
" ON CONFLICT (projection_name)" +
|
||||
" DO UPDATE SET locker_id = $1, locked_until = now()+$2::INTERVAL"
|
||||
lockStmtFormat = "UPDATE %[1]s" +
|
||||
" set locker_id = $1, locked_until = now()+$2::INTERVAL" +
|
||||
" WHERE projection_name = $3"
|
||||
lockerIDReset = "reset"
|
||||
)
|
||||
|
||||
@@ -136,7 +135,7 @@ func (q *Queries) checkAndLock(ctx context.Context, projectionName string) error
|
||||
if err != nil || rows == 0 {
|
||||
return errors.ThrowInternal(err, "QUERY-Bh3ws", "Errors.RemoveFailed")
|
||||
}
|
||||
time.Sleep(7 * time.Second) //more than twice the default lock duration (10s)
|
||||
time.Sleep(7 * time.Second) //more than half the default lock duration (10s)
|
||||
return nil
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user