mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
Calibre: Minor QoL fixes (#7528)
* CalibreMetadata: Get rid of the now useless NULL-hunt: here, this was basically looking for `rapidjson.null` to replace them with... `rapidjson.null` :?. IIRC, that's a remnant of a quirk of the previous JSON parser (possibly even the previous, *previous* JSON parser ^^). * CalibreSearch: Update the actually relevant NULL-hunt to make it explicit: replace JSON NULLs with Lua nils, instead of relying on an implementation detail of Lua-RapidJSON, because that detail just changed data type ;). * UIManager: Make sure tasks scheduled during the final ZMQ callback are honored. e.g., the Calibre "Disconnect" handler. This happened to mostly work purely by chance before the event loop rework. * Calibre: Restore a proper receiveCallback handler after receiving a book, in order not to break the "Disconnect" handler's state (and, well, get a working Disconnect handler, period ^^). * Calibre: Unbreak metadata cache when it's initialized by a search (regression since #7159). * Calibre: Handle UTC <-> local time conversions when checking the cache's timestamp against the Calibre metadata timestamp. * Bump base (Unbreak CRe on Android, update RapidJSON)
This commit is contained in:
@@ -57,11 +57,11 @@ end
|
||||
|
||||
function StreamMessageQueue:waitEvent()
|
||||
local data = ""
|
||||
-- Successive zframes may be tens or hundreds in some cases
|
||||
-- if they are concatenated in a single loop it may run up memory of the
|
||||
-- machine. And it did happened when receiving file data from Calibre server.
|
||||
-- Here we receive only receive 10 packages at most in one waitEvent loop, and
|
||||
-- call receiveCallback immediately.
|
||||
-- Successive zframes may come in batches of tens or hundreds in some cases.
|
||||
-- If they are concatenated in a single loop, it may consume a significant amount
|
||||
-- of memory. And it's fairly easy to trigger when receiving file data from Calibre.
|
||||
-- So, throttle reception to 10 packages at most in one waitEvent loop,
|
||||
-- after which we immediately call receiveCallback.
|
||||
local wait_packages = 10
|
||||
while czmq.zpoller_wait(self.poller, 0) ~= nil and wait_packages > 0 do
|
||||
local id_frame = czmq.zframe_recv(self.socket)
|
||||
|
||||
Reference in New Issue
Block a user