mirror of
https://github.com/GopeedLab/gopeed.git
synced 2026-11-19 14:53:44 +00:00
perf: extension onStart hook will block task create (#844)
This commit is contained in:
2 files changed
+9
-3
No files matched your search
@@ -1018,8 +1018,6 @@ func (d *Downloader) doStart(task *Task) (err error) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
isCreate = task.Status == base.DownloadStatusReady
|
isCreate = task.Status == base.DownloadStatusReady
|
||||||
|
|
||||||
d.triggerOnStart(task)
|
|
||||||
task.updateStatus(base.DownloadStatusRunning)
|
task.updateStatus(base.DownloadStatusRunning)
|
||||||
|
|
||||||
return
|
return
|
||||||
@@ -1036,6 +1034,7 @@ func (d *Downloader) doStart(task *Task) (err error) {
|
|||||||
task.lock.Lock()
|
task.lock.Lock()
|
||||||
defer task.lock.Unlock()
|
defer task.lock.Unlock()
|
||||||
|
|
||||||
|
d.triggerOnStart(task)
|
||||||
if task.Meta.Res == nil {
|
if task.Meta.Res == nil {
|
||||||
err := task.fetcher.Resolve(task.Meta.Req)
|
err := task.fetcher.Resolve(task.Meta.Req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
@@ -8,10 +8,17 @@ void showErrorMessage(msg) {
|
|||||||
Get.snackbar(title, msg.msg!);
|
Get.snackbar(title, msg.msg!);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (msg is Exception && (msg as dynamic).message is Result) {
|
if (msg is Exception) {
|
||||||
|
final message = (msg as dynamic).message;
|
||||||
|
if (message is Result) {
|
||||||
Get.snackbar(title, ((msg as dynamic).message as Result).msg!);
|
Get.snackbar(title, ((msg as dynamic).message as Result).msg!);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (message is String) {
|
||||||
|
Get.snackbar(title, message);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
Get.snackbar(title, msg.toString());
|
Get.snackbar(title, msg.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user