alphapapa / ement.el

A Matrix client for GNU Emacs
GNU General Public License v3.0
488 stars 44 forks source link

Duplicate idle timers (ement-read-receipt-idle-timer) #196

Closed phil-s closed 1 year ago

phil-s commented 1 year ago

I think ement-after-initial-sync-hook is called per session, and creates a duplicate idle timer each time?

(defun ement--run-idle-timer (&rest _ignore)
  "Run idle timer that updates read receipts.
To be called from `ement-after-initial-sync-hook'.  Timer is
stored in `ement-read-receipt-idle-timer'."
  (setf ement-read-receipt-idle-timer (run-with-idle-timer 3 t #'ement-room-read-receipt-idle-timer)))

It seems like it should simply test the variable to see whether it's already a timer?

phil-s commented 1 year ago

And if ement can disconnect from individual sessions then I expect ement--stop-idle-timer called from ement-disconnect-hook also needs to check for remaining sessions.

alphapapa commented 1 year ago

Thanks.