🐛 Fix sql statement

This commit is contained in:
LittleSheep 2024-08-18 16:25:07 +08:00
parent 1cce7c9b81
commit 6969a0e76c
2 changed files with 4 additions and 6 deletions

View File

@ -4,10 +4,7 @@
<option name="autoReloadType" value="ALL" /> <option name="autoReloadType" value="ALL" />
</component> </component>
<component name="ChangeListManager"> <component name="ChangeListManager">
<list default="true" id="18dd0d68-b4b8-40db-9734-9119b5c848bd" name="更改" comment=":bug: Fix migration issue on pools"> <list default="true" id="18dd0d68-b4b8-40db-9734-9119b5c848bd" name="更改" comment=":bug: Fix schedule deletion will delete referenced file" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/pkg/internal/services/recycler.go" beforeDir="false" afterPath="$PROJECT_DIR$/pkg/internal/services/recycler.go" afterDir="false" />
</list>
<option name="SHOW_DIALOG" value="false" /> <option name="SHOW_DIALOG" value="false" />
<option name="HIGHLIGHT_CONFLICTS" value="true" /> <option name="HIGHLIGHT_CONFLICTS" value="true" />
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" /> <option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
@ -124,7 +121,8 @@
<MESSAGE value=":sparkles: Pool clean by lifecycle config" /> <MESSAGE value=":sparkles: Pool clean by lifecycle config" />
<MESSAGE value=":recycle: Split mark and delete file" /> <MESSAGE value=":recycle: Split mark and delete file" />
<MESSAGE value=":bug: Fix migration issue on pools" /> <MESSAGE value=":bug: Fix migration issue on pools" />
<option name="LAST_COMMIT_MESSAGE" value=":bug: Fix migration issue on pools" /> <MESSAGE value=":bug: Fix schedule deletion will delete referenced file" />
<option name="LAST_COMMIT_MESSAGE" value=":bug: Fix schedule deletion will delete referenced file" />
</component> </component>
<component name="VgoProject"> <component name="VgoProject">
<settings-migrated>true</settings-migrated> <settings-migrated>true</settings-migrated>

View File

@ -51,7 +51,7 @@ func RunMarkDeletionTask() {
for _, pool := range pendingPools { for _, pool := range pendingPools {
lifecycle := fmt.Sprintf("%d seconds", *pool.Config.Data().ExistLifecycle) lifecycle := fmt.Sprintf("%d seconds", *pool.Config.Data().ExistLifecycle)
tx := database.C. tx := database.C.
Where("pool_id = ? AND AND created_at < NOW() - INTERVAL ?", pool.ID, lifecycle). Where("pool_id = ? AND created_at < NOW() - INTERVAL ?", pool.ID, lifecycle).
Updates(&models.Attachment{CleanedAt: lo.ToPtr(time.Now())}) Updates(&models.Attachment{CleanedAt: lo.ToPtr(time.Now())})
log.Info(). log.Info().
Str("pool", pool.Alias). Str("pool", pool.Alias).