Skip to content

Execute only changed commands #682

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

Merged
merged 4 commits into from
Jul 8, 2020
Merged

Conversation

kellda
Copy link
Contributor

@kellda kellda commented Jul 8, 2020

This makes commands only be executed if they changed.

Fixes #114

Copy link
Member

@Mark-Simulacrum Mark-Simulacrum left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks amazing! I think we should drop the (now not necessary) guards against other events, to simplify the code a bit.

It would also be good if we could extract the "reparsing" to a function somewhere (maybe just freestanding) to avoid duplicating the code.

log::debug!("skipping event, issue was {:?}", e.action);
// skip events other than opening the issue to avoid retriggering commands in the
// skip events other than opening or editing the issue to avoid retriggering commands in the
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, so if we're correctly handling things, this should be entirely removable, right? Since we'll never retrigger unless the command has been edited.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well I though about doing so, but there are really a lot of event that targets issues. So I think its worth to skip the whole parsing when e.g. just labels changed

@kellda
Copy link
Contributor Author

kellda commented Jul 8, 2020

About extracting the "repasing", I think there is generally a lot that can be refactored do avoid duplicate code. E.g. it seems that a message is parsed once in each handler, while it could be parsed only once and the result of that passed to each handler.

@Mark-Simulacrum
Copy link
Member

I agree -- initially the duplication happened due to a lack of knowledge about what the right abstraction is, and I think that's still (to some extent) true -- not all of our handlers have the same handling. But I do think in this case it's pretty clear that the code is essentially identical between all the places, so deduplicating it makes sense.

@kellda
Copy link
Contributor Author

kellda commented Jul 8, 2020

I can try to extract common code to a common place, but I'd rather do so in another PR.

Btw are multiple command in the same comment supported ?

@Mark-Simulacrum
Copy link
Member

I forget (would need to look at code). It's not an explicit goal, though would of course be a nice to have.

I think this looks good now, though, so merging (and it will automatically deploy soon thereafter).

@Mark-Simulacrum Mark-Simulacrum merged commit c6d4fc9 into rust-lang:master Jul 8, 2020
@kellda kellda deleted the diff-command branch July 9, 2020 04:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Don't re-assign user if they're already assigned
2 participants