Skip to content

Commit

Permalink
Fix fetchMeta may not use latest token
Browse files Browse the repository at this point in the history
  • Loading branch information
lifegpc committed May 25, 2024
1 parent b55c08b commit acc53e5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions lib/task.dart
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,15 @@ class TaskManager {

void addToTasksList(Task task, TaskStatus status) {
if (task.type == TaskType.download && !meta.containsKey(task.gid)) {
peddingGids.add(task.gid);
peddingTokens.add(task.token);
if (peddingGids.contains(task.gid)) {
final index = peddingGids.indexOf(task.gid);
if (peddingTokens[index]! != task.token) {
peddingTokens[index] = task.token;
}
} else {
peddingGids.add(task.gid);
peddingTokens.add(task.token);
}
}
if (status == TaskStatus.finished) {
tasksList.add(task.id);
Expand Down

0 comments on commit acc53e5

Please sign in to comment.