feat(task): add speed monitor (#7655)

This commit is contained in:
KirCute_ECT
2024-12-25 21:09:54 +08:00
committed by GitHub
parent db99224126
commit d7aa1608ac
18 changed files with 116 additions and 44 deletions

View File

@ -4,6 +4,7 @@ import (
"fmt"
"os"
"path/filepath"
"time"
"github.com/alist-org/alist/v3/internal/model"
"github.com/alist-org/alist/v3/internal/op"
@ -16,7 +17,7 @@ import (
)
type TransferTask struct {
task.TaskWithCreator
task.TaskExtension
FileDir string `json:"file_dir"`
DstDirPath string `json:"dst_dir_path"`
TempDir string `json:"temp_dir"`
@ -25,6 +26,9 @@ type TransferTask struct {
}
func (t *TransferTask) Run() error {
t.ClearEndTime()
t.SetStartTime(time.Now())
defer func() { t.SetEndTime(time.Now()) }()
// check dstDir again
var err error
if (t.file == File{}) {