Skip to content

Commit

Permalink
perf: extension onStart hook will block task create (#844)
Browse files Browse the repository at this point in the history
  • Loading branch information
monkeyWie authored Dec 21, 2024
1 parent 81dfc07 commit 2cb93a0
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
3 changes: 1 addition & 2 deletions pkg/download/downloader.go
Original file line number Diff line number Diff line change
Expand Up @@ -1018,8 +1018,6 @@ func (d *Downloader) doStart(task *Task) (err error) {
return
}
isCreate = task.Status == base.DownloadStatusReady

d.triggerOnStart(task)
task.updateStatus(base.DownloadStatusRunning)

return
Expand All @@ -1036,6 +1034,7 @@ func (d *Downloader) doStart(task *Task) (err error) {
task.lock.Lock()
defer task.lock.Unlock()

d.triggerOnStart(task)
if task.Meta.Res == nil {
err := task.fetcher.Resolve(task.Meta.Req)
if err != nil {
Expand Down
13 changes: 10 additions & 3 deletions ui/flutter/lib/util/message.dart
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@ void showErrorMessage(msg) {
Get.snackbar(title, msg.msg!);
return;
}
if (msg is Exception && (msg as dynamic).message is Result) {
Get.snackbar(title, ((msg as dynamic).message as Result).msg!);
return;
if (msg is Exception) {
final message = (msg as dynamic).message;
if (message is Result) {
Get.snackbar(title, ((msg as dynamic).message as Result).msg!);
return;
}
if (message is String) {
Get.snackbar(title, message);
return;
}
}
Get.snackbar(title, msg.toString());
}
Expand Down

0 comments on commit 2cb93a0

Please sign in to comment.