Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide an function to clear the task ( remove its data in the internal database which used to resuming from the breakpoint, and remove the Intermediate/downloaded file) #218

Closed
xanaduo opened this issue Jul 19, 2016 · 5 comments

Comments

@xanaduo
Copy link

xanaduo commented Jul 19, 2016

不管是从你的Demo上看还是从方法上都没发现有取消任务的操作,能不能提供一个取消的方法?或者下载的进度数据保存在什么地方,怎么去除掉?

@Jacksgong
Copy link
Collaborator

Jacksgong commented Jul 19, 2016

FileDownloader#pause() 暂停任务是相对与下次启动会自动断点续传来说的,实质上在缓存层面已经释放了所有的Task的数据。

若是任务的下载过程中间文件被删除了(FileDownloadUtils#getTempPath),在下载服务启动的时候会清除数据库中的该条记录。

若是请求发现服务端文件已经修改,无法进行断点续传,也会弃用数据库中的数据。

若是某个任务已经下载完成,数据库中的数据也会被删除掉。


如果真的有需求需要清除掉任务,并删除掉数据库中的数据,不管断点续传,只需要在暂停以后,删除掉其中间文件即可(FileDownloadUtils#getTempPath),

@xanaduo
Copy link
Author

xanaduo commented Jul 19, 2016

我把缓存文件删除了,再次点击下载确实是重新开始下载,但我发FileDownloadListener的FileDownloadMessage监听还存留着之前的进度,然后就会出现先会显示之前的进度。不知道是不是我控制的问题。你自己在Demo中尝试下这个取消的操作,看是否会出现这个问题。

@Jacksgong
Copy link
Collaborator

pending的时候,是会带回旧的进度的(如果数据库中的数据还存在),这个是设计如此。如果这个不达你的预期可以不使用这个参数。

@Jacksgong
Copy link
Collaborator

Jacksgong commented Jul 20, 2016

不过综合考虑。在接下来的版本我会增加一个接口: 清除某个任务。

@Jacksgong Jacksgong changed the title 对于正在下载的任务如何取消? 提供 清除某任务的接口 Jul 23, 2016
@Jacksgong Jacksgong changed the title 提供 清除某任务的接口 Provide an function to clear the task ( remove its data in the internal database which used to resuming from breakpoint, and remove the Intermediate/downloaded file) Jul 23, 2016
@Jacksgong Jacksgong changed the title Provide an function to clear the task ( remove its data in the internal database which used to resuming from breakpoint, and remove the Intermediate/downloaded file) Provide an function to clear the task ( remove its data in the internal database which used to resuming from the breakpoint, and remove the Intermediate/downloaded file) Jul 23, 2016
@Jacksgong
Copy link
Collaborator

Enhanced since 0.3.4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants