-
Notifications
You must be signed in to change notification settings - Fork 11
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
Feature: Implement Graceful shutdown #21
Conversation
… image with specified IMAGE_NAME variable
…y different ports
Feature: documentation
Feature/docs and clean code
Feature: graceful shutdown
cmd/proxy/server/server.go
Outdated
select { | ||
case sig := <-signalChan: | ||
log.Printf("Received shutdown signal: %s, shutting down gracefully...", sig) | ||
cancel() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As you can see here, when we receive signal into signalChan, we call cancel func, which closes our context, and 'graceful-shutdowning' process begins.
go.mod
Outdated
@@ -4,29 +4,31 @@ go 1.22.0 | |||
|
|||
require ( | |||
github.com/Netflix/go-env v0.0.0-20220526054621-78278af1949d | |||
github.com/cdipaolo/goml v0.0.0-20220715001353-00e0c845ae1c | |||
github.com/corazawaf/libinjection-go v0.1.3 | |||
github.com/emirpasic/gods v1.18.1 | |||
github.com/goccy/go-yaml v1.11.3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had to run go mod tidy here, seems we have some unused imports left.
As an idea, we can add these to our CI/CD pipeline, and check if go mod tidy
+ git diff
will return true, meaning that contributor should clean deps first.
…ject, since it can be later pushed
@cebilon123 while repairing CI/CD I've noticed that some tests took really long. After some investigation, I've reached to Is it needed? Or maybe it will be used later? |
Taskfile.yaml
Outdated
@@ -1,5 +1,8 @@ | |||
version: '3' | |||
|
|||
env: | |||
IMAGE_NAME: '{{ .IMAGE_NAME | default "qniw984/waffle:1.0.0" }}' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why qniw984 tho? 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed to <YOUR_USERNAME>
, so user can specify his/her username
cmd/proxy/main.go
Outdated
} | ||
}() | ||
|
||
log.Println("Server started on :8080") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it must be modified to the correct ports
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pkg/permission/windows.go
Outdated
//import ( | ||
// "fmt" | ||
// "golang.org/x/sys/windows" | ||
// "os" | ||
// "strings" | ||
// "syscall" | ||
//) | ||
// | ||
//func RunMeElevated() error { | ||
// verb := "runas" | ||
// exe, _ := os.Executable() | ||
// cwd, _ := os.Getwd() | ||
// args := strings.Join(os.Args[1:], " ") | ||
// | ||
// verbPtr, _ := syscall.UTF16PtrFromString(verb) | ||
// exePtr, _ := syscall.UTF16PtrFromString(exe) | ||
// cwdPtr, _ := syscall.UTF16PtrFromString(cwd) | ||
// argPtr, _ := syscall.UTF16PtrFromString(args) | ||
// | ||
// var showCmd int32 = 1 //SW_NORMAL | ||
// | ||
// err := windows.ShellExecute(0, verbPtr, exePtr, argPtr, cwdPtr, showCmd) | ||
// if err != nil { | ||
// return fmt.Errorf("windows shell execute: %w", err) | ||
// } | ||
// | ||
// return nil | ||
//} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can remove the whole file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
@thegodenage what about |
…ogin in registry then
@thegodenage Finally, CI is blue 🙂 |
@thegodenage where can we chat about helm? There are few things that I would like to know, before implementing it. |
@werniq Hey sure, sorry for late response, have a lot of different stuff in the meantime regarding daytime job and apartment. |
This PR introduces graceful shutdown functionality to the server. It ensures that the server properly handles shutdown signals (
SIGINT
,SIGTERM
), stops accepting new requests, and allows ongoing requests to complete before shutting down. The update includes:Shutdown
method to gracefully stop the server with a timeout.Start
andRun
methods to listen for shutdown signals and trigger the graceful shutdown process.This change enhances the server's stability by ensuring a smooth and controlled shutdown process.