Skip to content

Commit

Permalink
fixed infinite loading problem
Browse files Browse the repository at this point in the history
  • Loading branch information
pavelperc committed Nov 7, 2024
1 parent 5562cb7 commit 3e71665
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ class PlutoInterface private constructor(
val libInfo: LibraryInfoInterface
get() = LibraryInfoInterface(get.pluginActivityClass, get.selectorActivityClass)

val files: FilesInterface
get() = FilesInterface(get.application)
val files: FilesInterface by lazy { FilesInterface(get.application) } // singleton

fun create(
application: Application,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,10 @@ class ResponseReportingSinkCallback(
) : ReportingSink.Callback {

override fun onSuccess(file: File?, sourceByteCount: Long) {
file?.let { f ->
readResponseBuffer(f, response.isGzipped)?.let {
val responseBody = response.body ?: return
val body = responseBody.processBody(it)
onComplete.invoke(response.convert(body))
}
f.delete()
}
val buffer = file?.let { readResponseBuffer(it, response.isGzipped) }
val body = buffer?.let { response.body.processBody(it) }
file?.delete()
onComplete.invoke(response.convert(body))
}

override fun onFailure(file: File?, exception: IOException) = exception.printStackTrace()
Expand Down

0 comments on commit 3e71665

Please sign in to comment.