Skip to content

Commit

Permalink
fix:correct Slack Report using pingType=Report
Browse files Browse the repository at this point in the history
  • Loading branch information
pieceofr committed Jan 20, 2022
1 parent 065dbfe commit 63f70bd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion database.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ type PingResult struct {
TimeStamp int64 `gorm:"primaryKey;autoIncrement:false"`
Cluster string `gorm:"primaryKey"`
Hostname string
PingType string `gorm:"NOT NULL"`
PingType string `gorm:"NOT NULL;primaryKey"`
Submitted int `gorm:"NOT NULL"`
Confirmed int `gorm:"NOT NULL"`
Loss float64 `gorm:"NOT NULL"`
Expand Down
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ func getLatest(c *gin.Context) {
ret = GetLatestResult(Devnet)
default:
c.AbortWithStatus(http.StatusNotFound)
log.Println("StatusNotFound Error:", cluster)
return
}
c.IndentedJSON(http.StatusOK, ret)
Expand Down
2 changes: 1 addition & 1 deletion workers.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ func slackReportWorker(c Cluster) {
lastReporUnixTime = time.Now().UTC().Unix() - int64(config.Slack.ReportTime)
log.Println("reconstruct lastReport time=", lastReporUnixTime, "time now=", time.Now().UTC().Unix())
}
data := getAfter(c, DataPoint1Min, lastReporUnixTime)
data := getAfter(c, Report, lastReporUnixTime)
if len(data) <= 0 { // No Data
log.Println(c, " getAfter return empty")
time.Sleep(30 * time.Second)
Expand Down

0 comments on commit 63f70bd

Please sign in to comment.