Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Hubot entering infinite loop on issue search in FlowDock #422

Merged
merged 1 commit into from

4 participants

@christianmarth

Had issues with hubot entering an infinite loop when responding to an issue search, even when setting HUBOT_JIRA_IGNOREUSERS and HUBOT_JIRA_ISSUEDELAY

@christianmarth christianmarth Issue search changed from robot.hear to robot.respond
Had issues with hubot entering an infinite loop when responding to an issue search
4c82425
@tombell tombell merged commit 44c598d into github:master
@gregmac

This is 98% of the reason I use this plugin. Let's fix the issue with the loop, not cripple the bot. This commit needs to be reverted.

Can you reliably repo the problem? I am guessing if msg.message.user.id is robot.name return is supposed to prevent that, but I am pretty sure that condition will never be true (maybe it depends on the adapter?)

user.id is not always the same as robot.name. Hence why it can go into infinite loops. For example our hubot is called Sir Hubot in Campfire, and his robot.name is hubot.

I added ignoredusers support and that just uses msg.message.user.name .. so:
1) workaround is to add the robot's name to HUBOT_JIRA_IGNOREUSERS env variable
2) changing that line to if msg.message.user.name is robot.name will likely fix the original issue, unless that acts differently with different adapters.. anyone know?

Have tested changing to if msg.message.user.name is robot.name and change back to robot.hear and this is working fine now on the Flowdock adapter,

Sometimes i get hu responding with the same issue twice but this is not a deal breaker and is much better than an infinite loop

You cannot reliably use robot.name to check against the name of the user who sends the message. Because they're not always the same for hubot.

This should still be reverted; or have the documentation changed. I tried to get it to work, all in vain. The "recent issues" code should also fix this problem; it will not respond to issues mentioned the last 30 seconds again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on May 17, 2012
  1. @christianmarth

    Issue search changed from robot.hear to robot.respond

    christianmarth authored
    Had issues with hubot entering an infinite loop when responding to an issue search
This page is out of date. Refresh to see the latest.
Showing with 1 addition and 1 deletion.
  1. +1 −1  src/scripts/jira.coffee
View
2  src/scripts/jira.coffee
@@ -177,7 +177,7 @@ module.exports = (robot) ->
search msg, msg.match[2], (text) ->
msg.reply text
- robot.hear /([^\w\-]|^)(\w+-[0-9]+)(?=[^\w]|$)/ig, (msg) ->
+ robot.respond /([^\w\-]|^)(\w+-[0-9]+)(?=[^\w]|$)/ig, (msg) ->
if msg.message.user.id is robot.name
return
Something went wrong with that request. Please try again.