@@ -386,15 +386,25 @@ def cwa_internal_queue_duplicate_scan():
386386
387387 def _enqueue_scan ():
388388 try :
389+ log .debug ("[cwa-duplicates] Timer fired, attempting to import TaskDuplicateScan..." )
389390 from .tasks .duplicate_scan import TaskDuplicateScan
390- WorkerThread .add ('System' , TaskDuplicateScan (full_scan = False , trigger_type = 'after_import' ), hidden = False )
391+ log .debug ("[cwa-duplicates] TaskDuplicateScan imported successfully, creating task..." )
392+ task = TaskDuplicateScan (full_scan = False , trigger_type = 'after_import' )
393+ log .debug ("[cwa-duplicates] Task created, adding to WorkerThread..." )
394+ WorkerThread .add ('System' , task , hidden = False )
391395 log .info ("[cwa-duplicates] Debounced duplicate scan queued (after_import)" )
396+ print ("[cwa-duplicates] Debounced duplicate scan queued (after_import)" , flush = True )
392397 except Exception as e :
393398 log .error ("[cwa-duplicates] Failed to queue debounced duplicate scan: %s" , str (e ))
399+ print (f"[cwa-duplicates] ERROR: Failed to queue debounced duplicate scan: { e } " , flush = True )
400+ import traceback
401+ traceback .print_exc ()
394402
395403 _duplicate_scan_timer = Timer (delay_seconds , _enqueue_scan )
396404 _duplicate_scan_timer .daemon = True
397405 _duplicate_scan_timer .start ()
406+ log .info ("[cwa-duplicates] Timer started with %d second delay" , delay_seconds )
407+ print (f"[cwa-duplicates] Timer started with { delay_seconds } second delay" , flush = True )
398408
399409 return jsonify ({"success" : True , "queued" : True , "delay_seconds" : delay_seconds }), 200
400410 except Exception as e :
0 commit comments