mirror of
https://github.com/hoernschen/dendrite.git
synced 2025-07-31 13:22:46 +00:00
Prevent JetStream from handling OS signals, allow running as a Windows service (#2385)
* Prevent JetStream from handling OS signals, allow running as a Windows service (fixes #2374) * Remove double import
This commit is contained in:
parent
54ff4cf690
commit
d7cc187ec0
4 changed files with 10 additions and 2 deletions
|
@ -42,6 +42,7 @@ import (
|
|||
userdb "github.com/matrix-org/dendrite/userapi/storage"
|
||||
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/kardianos/minwinsvc"
|
||||
|
||||
appserviceAPI "github.com/matrix-org/dendrite/appservice/api"
|
||||
asinthttp "github.com/matrix-org/dendrite/appservice/inthttp"
|
||||
|
@ -462,7 +463,8 @@ func (b *BaseDendrite) SetupAndServeHTTP(
|
|||
}()
|
||||
}
|
||||
|
||||
<-b.ProcessContext.WaitForShutdown()
|
||||
minwinsvc.SetOnExit(b.ProcessContext.ShutdownDendrite)
|
||||
b.WaitForShutdown()
|
||||
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
cancel()
|
||||
|
@ -475,7 +477,10 @@ func (b *BaseDendrite) SetupAndServeHTTP(
|
|||
func (b *BaseDendrite) WaitForShutdown() {
|
||||
sigs := make(chan os.Signal, 1)
|
||||
signal.Notify(sigs, syscall.SIGINT, syscall.SIGTERM)
|
||||
<-sigs
|
||||
select {
|
||||
case <-sigs:
|
||||
case <-b.ProcessContext.WaitForShutdown():
|
||||
}
|
||||
signal.Reset(syscall.SIGINT, syscall.SIGTERM)
|
||||
|
||||
logrus.Warnf("Shutdown signal received")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue