fix: auto save block ask process
fix: mark all pending transfers canceled when app exit
This commit is contained in:
@@ -9,9 +9,16 @@ import (
|
||||
)
|
||||
|
||||
func (s *Service) SaveHistory() {
|
||||
// 将 pending 状态的任务改为 canceled
|
||||
transferList := s.GetTransferList()
|
||||
for _, task := range transferList {
|
||||
if task.Status == TransferStatusPending {
|
||||
task.Status = TransferStatusCanceled
|
||||
}
|
||||
}
|
||||
configDir := config.GetConfigDir()
|
||||
historyPath := filepath.Join(configDir, "history.json")
|
||||
historyJson, err := json.Marshal(s.GetTransferList())
|
||||
historyJson, err := json.Marshal(transferList)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user