thorium-reader icon indicating copy to clipboard operation
thorium-reader copied to clipboard

readingFinished refresh flag consume too much cpu load on reader and library

Open panaC opened this issue 2 months ago • 2 comments

https://github.com/edrlab/thorium-reader/commit/08b2c3c49ae976b811b805238c7bb020f6325208#r141722337

panaC avatar May 06 '24 16:05 panaC

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)

danielweck avatar May 06 '24 16:05 danielweck

So, to keep things simple, maybe just throttle the call to apiDispatch(dispatch)()("publication/readingFinishedRefresh") only?

danielweck avatar May 06 '24 16:05 danielweck