Skip to content

Commit

Permalink
fix: remove warnings and speed up HTTPD
Browse files Browse the repository at this point in the history
Removes 10 logs per side from a 'Basic' card in the reviewer

Android logs "W/System: A resource failed to call end." when a
 GZIPOutputStream is used temporarily without the outer stream
 being closed

It seems that there were 3 feasible solutions:
1) Disable gzip on the server
2) Disable all logs for this issue globally
3) Reflection + `ViolationLogger` (a `@hide` interface)

1) sped up execution on my phone, so was the obvious choice

Fixes 14924
  • Loading branch information
david-allison committed Dec 16, 2023
1 parent 8ddb882 commit 372a452
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions AnkiDroid/src/main/java/com/ichi2/anki/pages/AnkiServer.kt
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,10 @@ open class AnkiServer(
return "http://$LOCALHOST:$listeningPort/"
}

// it's faster to serve local files without GZip. see 'page render' in logs
// This also removes 'W/System: A resource failed to call end.'
override fun useGzipWhenAccepted(r: Response?) = false

override fun serve(session: IHTTPSession): Response {
val uri = session.uri
val mime = getMimeFromUri(uri)
Expand Down

0 comments on commit 372a452

Please sign in to comment.