feat(agent): add crash logs and watchdog startup
- Recover panics to disk for diagnostics - Add 5-minute watchdog task with startup - Add -ensure flag to start detached agent - Add script to pull remote folder via API
This commit is contained in:
@@ -8,6 +8,7 @@ import (
|
||||
"os"
|
||||
"sort"
|
||||
|
||||
"tea.chunkbyte.com/kato/go-worm/lib/crashlog"
|
||||
"tea.chunkbyte.com/kato/go-worm/lib/models"
|
||||
)
|
||||
|
||||
@@ -18,6 +19,7 @@ func RecoverHandler(next http.Handler) http.Handler {
|
||||
defer func() {
|
||||
if recovered := recover(); recovered != nil {
|
||||
Log.Printf("panic %s %s: %v", r.Method, r.URL.Path, recovered)
|
||||
crashlog.RecordPanic(recovered)
|
||||
WriteError(w, http.StatusInternalServerError, "internal server error")
|
||||
}
|
||||
}()
|
||||
|
||||
Reference in New Issue
Block a user