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

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

Open
wahyurama-creator opened this issue Jun 26, 2023 · 3 comments

Comments

@wahyurama-creator
Copy link

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?

@Umesh-Patidar
Copy link

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)

@tech-ajit-mob
Copy link

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

@tech-ajit-mob
Copy link

is there any update?

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

No branches or pull requests

3 participants