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

Gmail reconnects twice after disconnection #1

Closed
raisedintheusa opened this issue Apr 19, 2022 · 9 comments
Closed

Gmail reconnects twice after disconnection #1

raisedintheusa opened this issue Apr 19, 2022 · 9 comments
Labels
bug Something isn't working fixed

Comments

@raisedintheusa
Copy link

Hi, bot is working great, only issue I've experienced is after Gmail gets disconnected, it reconnects twice, resulting in messages sent to Voice being output twice on Matrix. A message sent from Matrix to Voice still gets sent once, so the issue is only one-way.

@dzg dzg added the bug Something isn't working label Apr 19, 2022
@dzg
Copy link
Owner

dzg commented Apr 19, 2022

Hm, haven't seen this on my end. Is that after getting a GMAIL: Disconnected, attempting reconnection... message from the bot?

@raisedintheusa
Copy link
Author

Yes,

�[33m GMAIL Error: Error: read ECONNRESET
Attempting reconnection...
🔴 GMAIL: Disconnected, attempting reconnection...
🟢 GMAIL: connected
🟢 GMAIL: connected

I'm running the bot on my laptop, which I put to sleep at night, so this happens when I wake it up in the morning.

@dzg
Copy link
Owner

dzg commented Apr 19, 2022

Can you try sending the bot a !restart command? LMK what it says. Curious if we get 1 or 2 connected messages.

@dzg
Copy link
Owner

dzg commented Apr 19, 2022

Also ... has this behavior been happening since the first time you ran the bot? Or did it just start recently?

@raisedintheusa
Copy link
Author

!restart gives the normal MATRIX: Connected GMAIL: connected messages, one for each. I only began running it on Sunday and it happened yesterday morning and this morning.

@dzg
Copy link
Owner

dzg commented Apr 19, 2022

OK, I think I know what the issue was. (At some point a 2nd mail client was started without stopping the first instance.) I pushed a new matrix-googlevoice-bot.js  – LMK how it goes!

@dzg
Copy link
Owner

dzg commented Apr 19, 2022

I'm running the bot on my laptop, which I put to sleep at night, so this happens when I wake it up in the morning.

I'm guessing the sleep cycle causes the mail client to lose its connection to Gmail. Then upon waking up it creates a new connection.

Can you send me the console log from when the laptop wakes up in the morning?

FWIW ... I run my bot on a free Oracle Cloud VM, so no sleeping/waking interruptions. Might be a more stable solution for you.

@raisedintheusa
Copy link
Author

I ran the updated code, put my computer to sleep for an hour so Gmail would disconnect, woke it back up, and the issue is resolved! Gmail reconnected just once and no further duplicate messages.
Thanks for the cloud VM recommendation, I'll look into that.

@dzg
Copy link
Owner

dzg commented Apr 20, 2022

Awesome. Thanks for finding the bug.

@dzg dzg added the fixed label Apr 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working fixed
Projects
None yet
Development

No branches or pull requests

2 participants