Skip to content
This repository has been archived by the owner on Jun 30, 2022. It is now read-only.

Lita receives last message again when restarted #101

Open
ekilah opened this issue Jul 29, 2016 · 1 comment
Open

Lita receives last message again when restarted #101

ekilah opened this issue Jul 29, 2016 · 1 comment
Labels

Comments

@ekilah
Copy link

ekilah commented Jul 29, 2016

Context: this is ported over from a conversation at litaio/lita#197

It seems that the Slack RTM connection always re-receives the last message that was sent by Lita when restarting the Lita process after a deploy.

I'm noticing this while trying to implement a :unhandled_message event handler in my custom Lita handler.

To clarify, here's the sequence I see:

> me: lita valid_command
> lita: response to valid_command
> me: other message(s), not necessarily directed at lita (this is optional)
# CTRL+C lita server, restart it with `lita start`
> lita: Sorry, I don't understand the command "response to valid_command".

The last line is produced by my on(:unhandled_message) block. Can anyone else replicate this behavior? It seems like a bug to me... or, at least, something that the adapter should filter out since it might be slack's "fault" (or feature)? I have yet to narrow down the cause. I'm a new Lita user.

I could probably work around it by seeing if the message was sent by the bot (sorta related to #95), but it seems like this shouldn't be necessary? I can also make this not happen as often by filtering by command? in the unhandled_message block, but that doesn't prevent DMs from suffering from this if that's where lita's last message went.

Lita logs showing this behavior: (my comments are prefixed by #s)

[2016-07-29 08:37:55 UTC] DEBUG: Dispatching message to Lita from <my UID>. # this is my unhandled message, lita replies to it immediately as expected
^C[2016-07-29 08:38:03 UTC] INFO: Disconnected from Slack.
[2016-07-29 08:38:03 UTC] DEBUG: Closing connection to the Slack Real Time Messaging API.
[2016-07-29 08:38:03 UTC] DEBUG: Closing connection to the Slack Real Time Messaging API.
bash-3.2$ lita start
[2016-07-29 08:38:04 UTC] DEBUG: Connecting to the Slack Real Time Messaging API.
[2016-07-29 08:38:05 UTC] DEBUG: Connected to the Slack Real Time Messaging API.
[2016-07-29 08:38:05 UTC] INFO: Connected to Slack.
[2016-07-29 08:38:05 UTC] DEBUG: reconnect_url event received from Slack and will be ignored.
[2016-07-29 08:38:05 UTC] DEBUG: Dispatching message to Lita from <Lita's UID> # this logs that Lita re-receives the message that it sent to me in response to the unhandled message
@ekilah
Copy link
Author

ekilah commented Sep 16, 2016

I will have to test again - for now, I've stopped trying to use the unhandled message handler.

However, this does sound a bit related to #90 so maybe it is resolved / a similar thing. I will try and test this theory and play with this more when I have some free time...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants