[server] Slow down crons

This commit is contained in:
Neeraj Gupta 2024-09-19 11:49:48 +05:30
parent a7cc96d994
commit a8c7dd52ba
2 changed files with 4 additions and 4 deletions

View File

@ -893,14 +893,14 @@ func setupAndStartCrons(userAuthRepo *repo.UserAuthRepository, publicCollectionR
}
})
schedule(c, "@every 2m", func() {
schedule(c, "@every 10m", func() {
fileController.CleanupDeletedFiles()
})
schedule(c, "@every 101s", func() {
embeddingCtrl.CleanupDeletedEmbeddings()
})
schedule(c, "@every 10m", func() {
schedule(c, "@every 17m", func() {
trashController.DropFileMetadataCron()
})
@ -926,7 +926,7 @@ func setupAndStartCrons(userAuthRepo *repo.UserAuthRepository, publicCollectionR
trashController.ProcessEmptyTrashRequests()
})
schedule(c, "@every 30m", func() {
schedule(c, "@every 45m", func() {
// delete unclaimed codes older than 60 minutes
_ = castDb.DeleteUnclaimedCodes(context.Background(), timeUtil.MicrosecondsBeforeMinutes(60))
dataCleanupCtrl.DeleteDataCron()

View File

@ -689,7 +689,7 @@ func (c *FileController) CleanupDeletedFiles() {
defer func() {
c.LockController.ReleaseLock(DeletedObjectQueueLock)
}()
items, err := c.QueueRepo.GetItemsReadyForDeletion(repo.DeleteObjectQueue, 2000)
items, err := c.QueueRepo.GetItemsReadyForDeletion(repo.DeleteObjectQueue, 1000)
if err != nil {
log.WithError(err).Error("Failed to fetch items from queue")
return