Fix image loading not working after a while

http-easy connections are pooled, and streaming responses does not
automatically close the response (they are closed automatically in
other situations). After 128 (the default) opened connections to fetch
images, the pool ran out of connections, and future attempts would
just time out waiting for a connection.

Fixed by manually closing the connection at the correct time.
This commit is contained in:
Cadence Ember 2022-09-03 19:55:17 +12:00
parent 3f1aeb8414
commit a2ec8bb923
Signed by: cadence
GPG key ID: BC1C2C61CF521B17

View file

@ -24,6 +24,7 @@
#:code (easy:response-status-code dest-r) #:code (easy:response-status-code dest-r)
#:mime-type (easy:response-headers-ref dest-r 'content-type) #:mime-type (easy:response-headers-ref dest-r 'content-type)
(λ (out) (λ (out)
(copy-port (easy:response-output dest-r) out))))) (copy-port (easy:response-output dest-r) out)
(easy:response-close! dest-r)))))
(next-dispatcher))] (next-dispatcher))]
[#f (next-dispatcher)])) [#f (next-dispatcher)]))