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

Fix the bug with SIGTERM non-graceful handling #247

Merged

Conversation

Oberonus
Copy link

@Oberonus Oberonus commented Aug 6, 2020

Signed-off-by: Alex Demin a.demin@thebeat.co

Which problem is this PR solving?

This PR closes #246

Short description of the changes

  • Replaces cancelled context in http server Shutdown with configurable timed context (default shutdown grace period is 5 seconds)
  • Removes global BaseContext from http service.

Signed-off-by: Alex Demin <a.demin@thebeat.co>
Signed-off-by: Alex Demin <a.demin@thebeat.co>
Signed-off-by: Alex Demin <a.demin@thebeat.co>
cb.errors = append(cb.errors, errors.New("negative or zero shutdown grace period provided"))
} else {
log.Infof("setting shutdown grace period")
cb.httpWriteTimeout = gp
Copy link

Choose a reason for hiding this comment

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

wrong assignment

Copy link
Author

Choose a reason for hiding this comment

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

yes, was a typo, fixed in 49ebea3

component/http/component.go Show resolved Hide resolved
@codecov
Copy link

codecov bot commented Aug 6, 2020

Codecov Report

Merging #247 into master will increase coverage by 0.05%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #247      +/-   ##
==========================================
+ Coverage   73.16%   73.22%   +0.05%     
==========================================
  Files          61       61              
  Lines        3667     3675       +8     
==========================================
+ Hits         2683     2691       +8     
  Misses        907      907              
  Partials       77       77              
Impacted Files Coverage Δ
component/http/component.go 97.81% <100.00%> (+0.13%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update b65270a...773e22e. Read the comment docs.

Signed-off-by: Alex Demin <a.demin@thebeat.co>
@Oberonus Oberonus requested a review from mantzas August 6, 2020 14:10
Copy link

@tpaschalis tpaschalis left a comment

Choose a reason for hiding this comment

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

LGTM! 🔥

@tpaschalis tpaschalis merged commit b21636c into beatlabs:master Aug 6, 2020
Stefos pushed a commit to Stefos/patron that referenced this pull request Oct 8, 2020
Signed-off-by: Alex Demin <a.demin@thebeat.co>

Co-authored-by: Sotirios Mantziaris <s.mantziaris@thebeat.co>
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.

Handle SIGTERM gracefully
3 participants