File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -251,13 +251,23 @@ def sync_cycle(self):
251251 logger .info (" 🤷 State matched to avoid loop." )
252252 if kosync_delta > 0 and not kosync_changed :
253253 logger .info (f" ✋ KoSync delta { kosync_delta :.4%} (Below threshold { self .delta_kosync_thresh :.2%} ): { ebook_filename } " )
254- prev_state ['kosync_pct' ] = kosync_progress
255- prev_state ['last_updated' ] = time .time ()
256- ## change me
257- prev_state ['kosync_index' ] = 0
258- self .state [abs_id ] = prev_state
259- self ._save_state ()
260- logger .info (" 🤷 State matched to avoid loop." )
254+ logger .debug (f" 🪲 Attempting to resolve character delta" )
255+
256+ index_delta = self .ebook_parser .get_character_delta (ebook_filename , prev_state ['kosync_pct' ], kosync_progress )
257+ logger .debug (f" 🪲 KoSync character delta { index_delta } " )
258+
259+ ## Hardcoded for testing! Adjust for new env variable.
260+ if index_delta > 2000 :
261+ kosync_changed = True
262+ logger .debug (f" 🪲 KoSync character delta larger than threshhold!" )
263+ else :
264+ prev_state ['kosync_pct' ] = kosync_progress
265+ prev_state ['last_updated' ] = time .time ()
266+ ## change me
267+ prev_state ['kosync_index' ] = 0
268+ self .state [abs_id ] = prev_state
269+ self ._save_state ()
270+ logger .info (" 🤷 State matched to avoid loop." )
261271
262272 if not abs_changed and not kosync_changed : continue
263273
You can’t perform that action at this time.
0 commit comments