feat: implement task cancellation feature and update task handling

This commit is contained in:
krau
2025-02-27 22:02:16 +08:00
parent 98ba7c50e7
commit be6444cf96
9 changed files with 103 additions and 24 deletions

View File

@@ -36,6 +36,7 @@ var StorageTypeDisplay = map[StorageType]string{
type Task struct {
Ctx context.Context
Cancel context.CancelFunc
Error error
Status TaskStatus
File *File
@@ -52,6 +53,10 @@ type Task struct {
UserID int64
}
func (t Task) Key() string {
return fmt.Sprintf("%d:%d", t.FileChatID, t.FileMessageID)
}
func (t Task) String() string {
return fmt.Sprintf("[%d:%d]:%s", t.FileChatID, t.FileMessageID, t.File.FileName)
}