hubot-archive / hubot-pager-me

PagerDuty integration for Hubot
https://www.npmjs.com/package/hubot-pager-me
MIT License
73 stars 92 forks source link

who's on call for XYZ loops if multiple matches exist #95

Closed TKonczynski closed 5 years ago

TKonczynski commented 8 years ago

Whenever I type "Who's on call for XYZ", and there are more matches than just XYZ, then the replies loop, displaying +1 entry every time.

Example:

Who's on call for XYZ

A batch of responses comes, one after another:

Person A is on call for XYZ Person A is on call for XYZ Person B is on call for XYZ1 Person A is on call for XYZ Person B is on call for XYZ1 Person C is on call for XYZ2 Person A is on call for XYZ Person B is on call for XYZ1 Person C is on call for XYZ2 Person D is on call for XYZ3

...and so on, until it loops through all the possible matches of XYZ

stephenyeargin commented 8 years ago

/cc @awiddersheim

awiddersheim commented 8 years ago

@TKonczynski I guess I'm not sure what you mean by "multiple matches". Can you give a more fleshed out example of what your schedules look like and the responses?

TKonczynski commented 8 years ago

@awiddersheim Sure! :) Let's just elaborate on what I've written with a clearer example.

Let's say I want to check the schedule of a team called 'Utilities', so I go ahead and type

who's on call for Utilities

However, there are more teams who have the word Utilities in their names, say, Useful Utilities, Necessary Utilities, Essential Utilities, Expendable Utilities, so I will get more that one response, because my query matches more than 1 result. Let's say there are 4 teams in total - the ones that I've mentioned The result that I expect to get after running this command is:

Person A is on call for Useful Utilities
Person B is on call for Necessary Utilities
Person C is on call for Essential Utilities
Person D is on call for Expendable Utilities

However, what I get instead is 4 replies one by one (because there are 4 teams), with each reply having one more line than the previous one; it looks like this:

Person A is on call for Useful Utilities
Person A is on call for Useful Utilities
Person B is on call for Necessary Utilities
Person A is on call for Useful Utilities
Person B is on call for Necessary Utilities
Person C is on call for Essential Utilities
Person A is on call for Useful Utilities
Person B is on call for Necessary Utilities
Person C is on call for Essential Utilities
Person D is on call for Expendable Utilities

Basically: the program should loop n times and display all results at the end of the loop, while now it displays the result after each run inside the loop.

awiddersheim commented 8 years ago

@TKonczynski thanks for the fleshed out example. I'll take a look and get back to you.

awiddersheim commented 8 years ago

@TKonczynski unfortunately, I'm no longer in a position where I can really deep dive on this anymore.

There was some deep debugging done on the same code area just recently in https://github.com/hubot-scripts/hubot-pager-me/issues/92. You can start adding some debug statements and some of the stuff in that issue might help you in doing that.

Might also want to try this diff in particular https://github.com/hubot-scripts/hubot-pager-me/issues/92#issuecomment-232828988.

TKonczynski commented 8 years ago

Thank you for you response, I'l look up #92

mcg commented 8 years ago

I have this same looping behavior. The diff referenced in #92 does fix the issue for me.

awiddersheim commented 8 years ago

@mcg which diff specifically?

mcg commented 8 years ago

https://github.com/hubot-scripts/hubot-pager-me/issues/92#issuecomment-232828988

awiddersheim commented 8 years ago

@mcg great thanks. That diff is basically a rollback of https://github.com/hubot-scripts/hubot-pager-me/pull/79.