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

Refactor Notification Engine for Escalations #9

Closed
wants to merge 2 commits into from

Conversation

dominikschulz
Copy link
Collaborator

This is my first attempt to implement the escalation logic for people and teams on a unified base for #2 .

To help with the implementation I've introduced some interfaces and moved the notification engine to it's own package. These changes are quite large and touch many parts of the project. Before moving on with tests, documentation and cleanup I'd first like to get some feedback if you'd feel comfortable merging these kind of changes.

Please do not merge this branch, yet.

This commit refactors the notification engine to its onw package.
Having the NE in it's own package will simplify further changes
to it and ease the implementation of escalation plans.
@dominikschulz dominikschulz changed the title Refactor Notification Engine Refactor Notification Engine for Escalations Jun 21, 2015
neConfig.SMTP.Sender = c.Config.Integrations.SMTP.Sender
neConfig.Service.ClickURLBase = c.Config.Service.ClickURLBase
neConfig.Service.CallbackURLBase = c.Config.Service.CallbackURLBase
c.Notify = ne.New(neConfig)
Copy link
Owner

Choose a reason for hiding this comment

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

Is there a reason you don't just pass c.Config to ne.New()? My brain is tired but all of these copies look awkward.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is not very clever, indeed. Passing c.Config would force me to include the parent package (main) in a subpackage, which I try to avoid. But I`ll have to figure out a better way to handle the config settings here before this gets merged. I was thinking about either factoring the config out to its own package which can be included in chicklittle main and its subpackages or using interfaces.

@chrissnell
Copy link
Owner

Very interesting. I need some time to digest this.

I really like how you've added interfaces. They feel much more Go-like than what was there before. I also like how you've moved the enqueueing/dequeueing logic out of the API and into helper functions. This improves readability significantly!

One comment on the breaking out of the notification engine into it's own package: I think the 'ne' name isn't very descriptive. I think 'notification' would be a more obvious choice. Thoughts?

Looks great. Once I sort through it and digest, I think we can definitely merge. I do think we should be doing all of the team notification work in its own branch and move to master when it's finally complete. I regret merging the incomplete, non-functional API to master and there are too many other bug fixes in there now to go and rip it out. Let's merge this into its own branch and continue our team notification development there.

Awesome work!!!

NIP NotificationsInProgress
planChan = make(chan *NotificationRequest)
cfgFile *string
c ChickenLittle
)

type ChickenLittle struct {
Copy link
Owner

Choose a reason for hiding this comment

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

I recently saw another project that used an object called "Service" to hold all of the shared data like we're doing here with the ChickenLittle struct. Once we get this branch merged, I want to go in and rename this struct to Service, because that makes more sense, e.g. Service.Config, Service.DB, etc.

@dominikschulz
Copy link
Collaborator Author

Thanks for your positive feedback. If you´d like to merge this to a separate feature branch I´d be happy to rebase my changes to this branch and keep on working in the branch until you think it`s ready for the master branch.

@dominikschulz
Copy link
Collaborator Author

The latest commit addresses the config issue by moving the config to it´s own package and renames ne to notification. The drawback I see with naming the notification engine package notification is that it´s less clear if you mean a single notification request, an notification step or the notification engine. That´s why I named it ne in the first place. Perhaps we can come up with a better name. IMHO it shouldn´t be too long, however.

@chrissnell
Copy link
Owner

Would you mind changing this PR to target the newly created teamescalation branch? I will merge it in there, then merge some of my additions from the teamrotation branch and we can start on the work needed to make escalation work.

@chrissnell
Copy link
Owner

BTW, I really appreciate all of the work you've done so I've made you a collaborator so you can commit to this repo. Please do all feature development work in feature branches. I regret polluting master with the team API stuff and will probably rip that out soon in order to return master to only having the people, notification plan, and notification APIs.

@dominikschulz
Copy link
Collaborator Author

Thanks! I did rebase already, but I'll have to put in some more work until the code can be reviewed.

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.

2 participants