Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
phil-s opened this issue Aug 3, 2023 · 2 comments
Closed

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

phil-s opened this issue Aug 3, 2023 · 2 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@phil-s
Copy link

phil-s commented Aug 3, 2023

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
Copy link
Author

phil-s commented Aug 3, 2023

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 alphapapa self-assigned this Aug 3, 2023
@alphapapa alphapapa added the bug Something isn't working label Aug 3, 2023
@alphapapa
Copy link
Owner

Thanks.

@alphapapa alphapapa added this to the 0.11 milestone Aug 3, 2023
phil-s pushed a commit to phil-s/ement.el that referenced this issue Aug 6, 2023
`ement--stop-idle-timer' called from `ement-disconnect-hook' also
needs to check for remaining sessions to avoid removing the timer
incorrectly.

See alphapapa#196
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants