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

instance restart (reload) event #2178

Merged
merged 3 commits into from Jun 12, 2018
Merged

instance restart (reload) event #2178

merged 3 commits into from Jun 12, 2018

Conversation

sirkon
Copy link

@sirkon sirkon commented May 23, 2018

1. What does this change do, exactly?

New event type called restart added which is emitted at server restart (at SIGUSR1)

2. Please link to the relevant issues.

We are using caddy as embedded server and we need to make preparations before restarts

3. Which documentation changes (if any) need to be made because of this PR?

Nothing

4. Checklist

  • I have written tests and verified that they fail without my change
  • I have squashed any insignificant commits
  • This change has comments for package types, values, functions, and non-obvious lines of code
  • I am willing to help maintain this change if there are issues with it later

@abiosoft
Copy link

LGTM

plugins.go Outdated
ShutdownEvent = "shutdown"
CertRenewEvent = "certrenew"
InstanceStartupEvent = "instancestartup"
InstanceRestart = "restart"
Copy link
Member

Choose a reason for hiding this comment

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

Can we make the string consistent with the name? "instancerestart"?

Copy link
Author

Choose a reason for hiding this comment

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

sure, done

plugins.go Outdated
ShutdownEvent = "shutdown"
CertRenewEvent = "certrenew"
InstanceStartupEvent = "instancestartup"
InstanceRestart = "instancerestart"

Choose a reason for hiding this comment

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

Maybe it also should be InstanceRestartEvent for consistency

Copy link
Author

Choose a reason for hiding this comment

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

indeed, pushed

sigtrap_posix.go Outdated
@@ -90,6 +90,7 @@ func trapSignalsPosix() {
purgeEventHooks()

// Kick off the restart; our work is done
EmitEvent(InstanceRestart, nil)
Copy link
Member

Choose a reason for hiding this comment

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

You missed this one 😛 needs to be InstanceRestartEvent too

Copy link
Author

Choose a reason for hiding this comment

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

oops, fixed :)

@mholt mholt merged commit 6965075 into caddyserver:master Jun 12, 2018
@mholt
Copy link
Member

mholt commented Jun 12, 2018

Thanks!

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.

None yet

6 participants