adding lastrun timestamp to status information

This commit is contained in:
farhan 2020-10-31 05:51:39 +00:00
parent 4050e336c3
commit bef25c73f5
2 changed files with 5 additions and 2 deletions

View File

@ -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)
}
}
}

View File

@ -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)