thorium-reader
thorium-reader copied to clipboard
readingFinished refresh flag consume too much cpu load on reader and library
https://github.com/edrlab/thorium-reader/commit/08b2c3c49ae976b811b805238c7bb020f6325208#r141722337
https://github.com/edrlab/thorium-reader/blob/08b2c3c49ae976b811b805238c7bb020f6325208/src/renderer/reader/components/Reader.tsx#L2825-L2830
https://github.com/edrlab/thorium-reader/blob/08b2c3c49ae976b811b805238c7bb020f6325208/src/renderer/reader/components/Reader.tsx#L2214-L2216
https://github.com/edrlab/thorium-reader/blob/08b2c3c49ae976b811b805238c7bb020f6325208/src/renderer/reader/components/Reader.tsx#L2223-L2235
https://github.com/edrlab/thorium-reader/blob/08b2c3c49ae976b811b805238c7bb020f6325208/src/renderer/reader/components/Reader.tsx#L540
setLocator
is called whenever TTS or Media Overlays audio playback is ongoing, which can flood the DB backend and React GUI with update requests unless throttled (debounced on leading edge would yield out-of-sync states especially if no leading edge terminator, and debounced on leading edge only would also cause massive refresh delays ... so throttle is probably the most reasonable / practical solution)
So, to keep things simple, maybe just throttle the call to apiDispatch(dispatch)()("publication/readingFinishedRefresh")
only?