fix: single conversion at a time

See the notes for a full explanation, but basically
Kobo is making simultaneous requests and the
files were conflicting because there were 2 being
downloaded / converted at the same time which
resulted in unreliable behavior.

The solution is to protect the conversion
section to allow a single conversion to complete
before allowing the next one to start.
This commit is contained in:
Evan Buss
2024-07-14 19:56:00 +00:00
parent 56cb81bbb4
commit be78d83bd6
3 changed files with 44 additions and 8 deletions

18
notes.md Normal file
View File

@@ -0,0 +1,18 @@
Kobo Browser Quirks
Apparently the browser is using a very old version of WebKit.
- Doesn't support `fetch`
- No HTMX
- Doesn't support `secure` or `httpOnly` cookies
- They just silently fail to be set with these flags
- Makes 2 parallel requests whenever an `<a>` link is clicked
- This doesn't seem to apply to URL bar navigation
- This poses issues when a request is not idempotent. Need to figure out a solution
for these cases... For example when converting to Kepub, we encounter failures
for the second requests due to file conflicts / deletions happening at the same time.
I've fixed this by locking the conversion to a single request at a time with a mutex,
but we still do the conversion twice, just one after the other.
I was planning on creating an OPDS interface for OpenBooks but this will make all
search / download requests send twice which is no good. The fix isn't as simple
in that case.