mirror of
https://github.com/hrfee/jfa-go.git
synced 2026-01-18 16:47:42 +01:00
fix bugs with restarts/interrupts
The password reset daemon wasn't being closed on restarts, so an extra pwr would be sent w/ every restart. Restarts & Interrupts (Ctrl-C) rarely worked, as there were multiple listeners to the "RESTART" channel, and I didn't know the message was consumed by whoever got it first, meaning if the main thread didn't get it first, the app wouldn't quit. Listeners are now registered, and the restart message is re-broadcasted until everyone's got it. Fixes #264
This commit is contained in:
4
api.go
4
api.go
@@ -359,6 +359,8 @@ func (app *appContext) ModifyConfig(gc *gin.Context) {
|
||||
} else {
|
||||
RESTART <- true
|
||||
}
|
||||
// Safety Sleep (Ensure shutdown tasks get done)
|
||||
time.Sleep(time.Second)
|
||||
}
|
||||
app.loadConfig()
|
||||
// Reinitialize password validator on config change, as opposed to every applicable request like in python.
|
||||
@@ -527,5 +529,7 @@ func (app *appContext) Restart() error {
|
||||
} else {
|
||||
RESTART <- true
|
||||
}
|
||||
// Safety Sleep (Ensure shutdown tasks get done)
|
||||
time.Sleep(time.Second)
|
||||
return nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user