From bef25c73f5380c5f550a080516f3cb1e6462f4ad Mon Sep 17 00:00:00 2001 From: Farhan Khan Date: Sat, 31 Oct 2020 05:51:39 +0000 Subject: [PATCH] adding lastrun timestamp to status information --- client/searchctl.go | 3 ++- poll/engine.go | 4 +++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/client/searchctl.go b/client/searchctl.go index 1f3fea0..a421ad7 100644 --- a/client/searchctl.go +++ b/client/searchctl.go @@ -20,6 +20,7 @@ type RunningInstance struct { Software string `json:"software"` Min_id string Status int `json:"status"` + LastRun string `json:"lastrun"` } type ResponseBack struct { @@ -110,7 +111,7 @@ func main() { case "status": fmt.Println("Status:" + responseback.Message) for x, runninginstance := range responseback.RunningInstances { - fmt.Println("ID:", x, runninginstance.Endpoint, runninginstance.Status) + fmt.Println("ID:", x, runninginstance.Endpoint, runninginstance.Status, runninginstance.LastRun) } } } diff --git a/poll/engine.go b/poll/engine.go index 954f9fd..d4ada34 100644 --- a/poll/engine.go +++ b/poll/engine.go @@ -70,6 +70,7 @@ type RunningInstance struct { Software string `json:"software"` Min_id string Status int `json:"status"` + LastRun string `json:"lastrun"` } type NodeInfoSoftware struct { @@ -345,7 +346,7 @@ func NewInstance(endpoint string, runninginstances *[]RunningInstance, instanceR }() } - newinstance := RunningInstance{endpoint, "", "", NEW_INSTANCE} + newinstance := RunningInstance{endpoint, "", "", NEW_INSTANCE, "QUEUED"} *runninginstances = append(*runninginstances, newinstance) if nodeinfo.Software.Name == "pleroma" || nodeinfo.Software.Name == "mastodon" { @@ -467,6 +468,7 @@ func engine() { if runninginstance.Endpoint == w.endpoint { runninginstances[i].Min_id = w.min_id runninginstances[i].Status = w.status + runninginstances[i].LastRun = time.Now().Format("2006.01.02-15:04:05") } } go DeferPollRun(w, &runninginstances, instanceReportChan, reportPostChan)