1.download a file
result: Fetch will return me an empty file and complete callback was invoked
@shuwenyouxi I am also facing this issue.
@tonyofrancis please look into this
Same issue here
I done small investigation, the problem occurs when the file url and filename is the same with each download. Only first download happen, next request will be completed instantly with file size 0B. I guess this is something about storing ids somewhere - ids are generated by hashcode of url and filename, so if any of them doesnt change the id will be the same as requests before.
Yes mostly because fetch doesn't check file existance when we try to add download with same filename as previously completed download.
Fetch only check if any download with this filename present or not and if present it will just move new request to completed downloas as default behavior of UPDATE_ACCCORDINGLY enque action.
@maulik9898 is correct! What you need to do is set enableFileExistChecks(true) on the fetchConfiguration or use a different enqueue action. See enableFileExistChecks(true) documentation. EnableFileExistChecks is off by default.
final FetchConfiguration fetchConfiguration = new FetchConfiguration.Builder(this)
.enableFileExistChecks(true)
.enableRetryOnNetworkGain(true)
.setDownloadConcurrentLimit(3)
.build();
final Fetch fetch = Fetch.Impl.getInstance(fetchConfiguration);
@maulik9898 is correct! What you need to do is set
enableFileExistChecks(true)on the fetchConfiguration or use a different enqueue action. SeeenableFileExistChecks(true)documentation. EnableFileExistChecks is off by default.final FetchConfiguration fetchConfiguration = new FetchConfiguration.Builder(this) .enableFileExistChecks(true) .enableRetryOnNetworkGain(true) .setDownloadConcurrentLimit(3) .build(); final Fetch fetch = Fetch.Impl.getInstance(fetchConfiguration);
But the checks fileExistChecksEnabled is true default, in the source code latest
const val DEFAULT_FILE_EXIST_CHECKS = true
@tonyofrancis
@alvince You are correct!. That was my mistake. File checking is enabled by default. The issue is with the enqueue action. The default is update_accordingly. It should be set to a different option.
@alvince You are correct!. That was my mistake. File checking is enabled by default. The issue is with the enqueue action. The default is update_accordingly. It should be set to a different option.
I think it was effected by file checking, and fixed it. #410
Please check it @tonyofrancis
@alvince provided a fix. It will be pushed in the next release.
@tonyofrancis May I known the time of next release
Still issue persists
My dependency
implementation "androidx.tonyodev.fetch2:xfetch2:3.1.4"
My config
FetchConfiguration fetchConfiguration = new FetchConfiguration.Builder(context)
.enableFileExistChecks(false)
.enableHashCheck(false)
.setAutoRetryMaxAttempts(30)
.setDownloadConcurrentLimit(20)
.build();
First time downloading fine. Next time it will return success result. but file empty (0KB)
Tried this too. .enableFileExistChecks(true) && .enableHashCheck(true) but same result
Still issue persists
My dependency
implementation "androidx.tonyodev.fetch2:xfetch2:3.1.4"My config
FetchConfiguration fetchConfiguration = new FetchConfiguration.Builder(context) .enableFileExistChecks(false) .enableHashCheck(false) .setAutoRetryMaxAttempts(30) .setDownloadConcurrentLimit(20) .build();First time downloading fine. Next time it will return success result. but file empty (0KB)
Tried this too. .enableFileExistChecks(true) && .enableHashCheck(true) but same result
waiting for this long time