fix(reaper): 回收前先停服并持有世界维护锁再归档,锁丢失不删卷;无世界卷的无主服务器只重置时钟不再重复回收
This commit is contained in:
14 files changed
+751
-51
No files matched your search
@@ -90,6 +90,13 @@ func (s *PGStore) ReleaseWorld(ctx context.Context, name string, at time.Time) e
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *PGStore) RestartClock(ctx context.Context, name string, at time.Time) error {
|
||||
const q = `UPDATE servers SET last_active_at = $2, warned_3d_at = NULL, warned_1d_at = NULL
|
||||
WHERE name = $1 AND deleted_at IS NULL`
|
||||
_, err := s.db.ExecContext(ctx, q, name, at)
|
||||
return err
|
||||
}
|
||||
|
||||
func (s *PGStore) MarkWarned(ctx context.Context, name string, tier Tier, at time.Time) error {
|
||||
// The column is one of two fixed identifiers, never user input.
|
||||
col := "warned_3d_at"
|
||||
|
||||
Reference in new issue
Block a user