fix: 按完成时刻分批清理并限制读连接池

This commit is contained in:
Nixevol
2026-09-30 15:47:32 +08:00
parent 75f4647cae
commit a4e51ec5cd
9 changed files with 350 additions and 17 deletions
+2 -2
View File
@@ -107,8 +107,8 @@ func (a *App) Recall(ctx context.Context, senderID string, req *protocol.Recall)
return err
}
if state == StateScheduled {
if _, e := tx.Exec(`UPDATE messages SET state = ?, reason = ? WHERE seq = ? AND state = 'scheduled'`,
StateCompleted, ReasonRecalled, seq); e != nil {
if _, e := tx.Exec(`UPDATE messages SET state = ?, reason = ?, completed_at = ? WHERE seq = ? AND state = 'scheduled'`,
StateCompleted, ReasonRecalled, nowMs, seq); e != nil {
return e
}
if _, e := tx.Exec(`DELETE FROM message_bodies WHERE seq = ?`, seq); e != nil {