lingochamp / lingochamp/FileDownloader

使用FileDownloadSerialQueue下载,经常会出现下载不全的情况。

Open
#1,353 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
11.1k
Forks
2.2k
PR merge metrics
No merged PRs in 30d

Description

FileDownloadSerialQueue queue = new FileDownloadSerialQueue();
FileDownloader.enableAvoidDropFrame();//避免掉帧
for (int i = 0; i < 10; i++) {
BaseDownloadTask baseDownloadTask = FileDownloader
.getImpl()
.create(Constant.URLS[i])
.setAutoRetryTimes(3)
.setCallbackProgressTimes(0)
.setPath(FileDownloadUtils.getDefaultSaveRootPath()+ "/" + i)
.setTag(i)
.addFinishListener(new BaseDownloadTask.FinishListener() {
@Override
public void over(BaseDownloadTask task) {
if(task.getStatus() == FileDownloadStatus.completed)
LogUtils.debugInfo("sgm", "====completed:" + (int) task.getTag());
}
});
queue.enqueue(baseDownloadTask);
}

代码是这样写的,经常出现只下载了5,6条完成,而没有下载10条数据,是不是线程阻塞了?

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the FileDownloadSerialQueue enqueue flow and the FileDownloader.getImpl().create entry point, then trace how the ten BaseDownloadTask instances are scheduled and completed. Reproduce the shown case with the FinishListener and determine why fewer than ten tasks reach the completed status; done means the cause and a verified correction are documented.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, java
Domain
mobile
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
20/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.