Skip to content

Commit

Permalink
Fixed a resource leak with OkHTTP
Browse files Browse the repository at this point in the history
  • Loading branch information
spacecowboy committed Apr 7, 2024
1 parent 475ec21 commit 148d4d1
Showing 1 changed file with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -171,21 +171,21 @@ class RssLocalSync(override val di: DI) : DIAware {
) {
okHttpClient.getResponse(feedSql.url, forceNetwork = forceNetwork)
}.flatMap { response ->
if (response.isSuccessful) {
response.use {
response.use {
if (response.isSuccessful) {
response.body?.let { responseBody ->
feedParser.parseFeedResponse(
response.request.url.toUrl(),
responseBody,
)
} ?: NoBody(url = url.toString()).left()
} else {
HttpError(
url = url.toString(),
code = response.code,
message = response.message,
).left()
}
} else {
HttpError(
url = url.toString(),
code = response.code,
message = response.message,
).left()
}
}.map {
// Double check that icon is not base64
Expand Down

0 comments on commit 148d4d1

Please sign in to comment.