tonyofrancis/Fetch

This fetch instance has been closed. Create a new instance using the builder

wahyurama-creator opened this issue · 3 comments

When i resume my activity, error is showing "com.tonyodev.fetch2.exception.FetchException: This fetch instance has been closed. Create a new instance using the builder", how to fix it?

I am getting same crash. Could you please check this.

private fun downloadMedia(filePath: String) {
val fetchConfiguration = FetchConfiguration.Builder(this)
.setDownloadConcurrentLimit(5)
.setProgressReportingInterval(500)
.build()
Fetch.Impl.setDefaultInstanceConfiguration(fetchConfiguration)
fetch = Fetch.Impl.getDefaultInstance()
val mediaRequest = url?.let { Request(it, filePath) }
mediaRequest?.let { request->
request.priority = Priority.HIGH
request.networkType = NetworkType.ALL
// fetch = if (fetch == null || fetch?.isClosed == true) FoneAppApplication.instance.getFetch() else fetch
fetch?.enqueue(request, { updatedRequest: Request? ->
Timber.d("Media File enqueue successfully!! ${updatedRequest?.id}")
}) { error: Error? ->
Timber.d("Media File is not enqueue!! ${error?.name}")
}
}

com.tonyodev.fetch2.exception.FetchException: This fetch instance has been closed. Create a new instance using the builder.
com.tonyodev.fetch2.fetch.FetchImpl.throwExceptionIfClosed(FetchImpl.kt:1226)
com.tonyodev.fetch2.fetch.FetchImpl.enqueueRequest(FetchImpl.kt:97)
com.tonyodev.fetch2.fetch.FetchImpl.enqueue(FetchImpl.kt:69)

I think it's a serious issue. We are facing the same when we are trying to download back-to-back images.

is there any update?