Kaynağa Gözat

perf(storage): Use SKIP LOCKED in ArchiveEntries

This is already the case in cleanupRemovedEntriesNotInFeed
jvoisin 1 hafta önce
ebeveyn
işleme
ca7c38a680
1 değiştirilmiş dosya ile 3 ekleme ve 1 silme
  1. 3 1
      internal/storage/entry.go

+ 3 - 1
internal/storage/entry.go

@@ -458,7 +458,9 @@ func (s *Storage) ArchiveEntries(status string, interval time.Duration, limit in
 					share_code='' AND
 					created_at < now () - $3::interval
 				ORDER BY
-					created_at ASC LIMIT $4
+					created_at ASC
+				FOR UPDATE SKIP LOCKED
+				LIMIT $4
 				)
 	`