mirror of
https://github.com/muety/wakapi.git
synced 2023-08-10 21:12:56 +03:00
fix: critical bug with data retention / cleanup
This commit is contained in:
parent
8e521741f8
commit
731598fa38
14
main.go
14
main.go
@ -324,7 +324,7 @@ func listen(handler http.Handler) {
|
|||||||
if config.Server.ListenSocket != "-" && config.Server.ListenSocket != "" {
|
if config.Server.ListenSocket != "-" && config.Server.ListenSocket != "" {
|
||||||
// Remove if exists
|
// Remove if exists
|
||||||
if _, err := os.Stat(config.Server.ListenSocket); err == nil {
|
if _, err := os.Stat(config.Server.ListenSocket); err == nil {
|
||||||
logbuch.Info("--> Removing unix socket %s", config.Server.ListenSocket)
|
logbuch.Info("👉 Removing unix socket %s", config.Server.ListenSocket)
|
||||||
if err := os.Remove(config.Server.ListenSocket); err != nil {
|
if err := os.Remove(config.Server.ListenSocket); err != nil {
|
||||||
logbuch.Fatal(err.Error())
|
logbuch.Fatal(err.Error())
|
||||||
}
|
}
|
||||||
@ -338,7 +338,7 @@ func listen(handler http.Handler) {
|
|||||||
|
|
||||||
if config.UseTLS() {
|
if config.UseTLS() {
|
||||||
if s4 != nil {
|
if s4 != nil {
|
||||||
logbuch.Info("--> Listening for HTTPS on %s... ✅", s4.Addr)
|
logbuch.Info("👉 Listening for HTTPS on %s... ✅", s4.Addr)
|
||||||
go func() {
|
go func() {
|
||||||
if err := s4.ListenAndServeTLS(config.Server.TlsCertPath, config.Server.TlsKeyPath); err != nil {
|
if err := s4.ListenAndServeTLS(config.Server.TlsCertPath, config.Server.TlsKeyPath); err != nil {
|
||||||
logbuch.Fatal(err.Error())
|
logbuch.Fatal(err.Error())
|
||||||
@ -346,7 +346,7 @@ func listen(handler http.Handler) {
|
|||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
if s6 != nil {
|
if s6 != nil {
|
||||||
logbuch.Info("--> Listening for HTTPS on %s... ✅", s6.Addr)
|
logbuch.Info("👉 Listening for HTTPS on %s... ✅", s6.Addr)
|
||||||
go func() {
|
go func() {
|
||||||
if err := s6.ListenAndServeTLS(config.Server.TlsCertPath, config.Server.TlsKeyPath); err != nil {
|
if err := s6.ListenAndServeTLS(config.Server.TlsCertPath, config.Server.TlsKeyPath); err != nil {
|
||||||
logbuch.Fatal(err.Error())
|
logbuch.Fatal(err.Error())
|
||||||
@ -354,7 +354,7 @@ func listen(handler http.Handler) {
|
|||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
if sSocket != nil {
|
if sSocket != nil {
|
||||||
logbuch.Info("--> Listening for HTTPS on %s... ✅", config.Server.ListenSocket)
|
logbuch.Info("👉 Listening for HTTPS on %s... ✅", config.Server.ListenSocket)
|
||||||
go func() {
|
go func() {
|
||||||
unixListener, err := net.Listen("unix", config.Server.ListenSocket)
|
unixListener, err := net.Listen("unix", config.Server.ListenSocket)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -367,7 +367,7 @@ func listen(handler http.Handler) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if s4 != nil {
|
if s4 != nil {
|
||||||
logbuch.Info("--> Listening for HTTP on %s... ✅", s4.Addr)
|
logbuch.Info("👉 Listening for HTTP on %s... ✅", s4.Addr)
|
||||||
go func() {
|
go func() {
|
||||||
if err := s4.ListenAndServe(); err != nil {
|
if err := s4.ListenAndServe(); err != nil {
|
||||||
logbuch.Fatal(err.Error())
|
logbuch.Fatal(err.Error())
|
||||||
@ -375,7 +375,7 @@ func listen(handler http.Handler) {
|
|||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
if s6 != nil {
|
if s6 != nil {
|
||||||
logbuch.Info("--> Listening for HTTP on %s... ✅", s6.Addr)
|
logbuch.Info("👉 Listening for HTTP on %s... ✅", s6.Addr)
|
||||||
go func() {
|
go func() {
|
||||||
if err := s6.ListenAndServe(); err != nil {
|
if err := s6.ListenAndServe(); err != nil {
|
||||||
logbuch.Fatal(err.Error())
|
logbuch.Fatal(err.Error())
|
||||||
@ -383,7 +383,7 @@ func listen(handler http.Handler) {
|
|||||||
}()
|
}()
|
||||||
}
|
}
|
||||||
if sSocket != nil {
|
if sSocket != nil {
|
||||||
logbuch.Info("--> Listening for HTTP on %s... ✅", config.Server.ListenSocket)
|
logbuch.Info("👉 Listening for HTTP on %s... ✅", config.Server.ListenSocket)
|
||||||
go func() {
|
go func() {
|
||||||
unixListener, err := net.Listen("unix", config.Server.ListenSocket)
|
unixListener, err := net.Listen("unix", config.Server.ListenSocket)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -52,7 +52,7 @@ func (s *HousekeepingService) Schedule() {
|
|||||||
|
|
||||||
user := *u
|
user := *u
|
||||||
s.queueWorkers.Dispatch(func() {
|
s.queueWorkers.Dispatch(func() {
|
||||||
if err := s.CleanUserDataBefore(&user, u.MinDataAge()); err != nil {
|
if err := s.CleanUserDataBefore(&user, user.MinDataAge()); err != nil {
|
||||||
config.Log().Error("failed to clear old user data for '%s'", user.ID)
|
config.Log().Error("failed to clear old user data for '%s'", user.ID)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
Loading…
Reference in New Issue
Block a user