Skip to content

Commit

Permalink
fix stats bug
Browse files Browse the repository at this point in the history
  • Loading branch information
TimothyYe committed Dec 11, 2017
1 parent a34be77 commit 231caf4
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
3 changes: 1 addition & 2 deletions jobs/daily_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package jobs

import (
"log"
"os"
"time"

"github.com/go-ignite/ignite/models"
Expand All @@ -16,7 +15,7 @@ func DailyStats() {
err := db.Where("service_id != '' AND status = 1").Find(&users)
if err != nil {
log.Println("Get users error: ", err.Error())
os.Exit(1)
return
}

//2. Stop expired containers
Expand Down
3 changes: 1 addition & 2 deletions jobs/instant_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package jobs

import (
"log"
"os"
"time"

"github.com/go-ignite/ignite/models"
Expand All @@ -29,7 +28,7 @@ func InstantStats() {
err := db.Where("service_id != '' AND status = 1").Find(&users)
if err != nil {
log.Println("Get users error: ", err.Error())
os.Exit(1)
return
}

// 2. Compute ss bandwidth
Expand Down
2 changes: 1 addition & 1 deletion jobs/monthly_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func MonthlyStats() {
err := db.Where("service_id != '' AND status = 2").Find(&users)
if err != nil {
log.Println("Get users error: ", err.Error())
os.Exit(1)
return
}

//2. Restart stopped but not expired containers
Expand Down
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func initJob(db *xorm.Engine) {
c := cron.New()
c.AddFunc("* */5 * * * *", jobs.InstantStats)
c.AddFunc("0 0 0 * * *", jobs.DailyStats)
c.AddFunc("0 0 1 * * *", jobs.MonthlyStats)
c.AddFunc("0 0 0 1 * *", jobs.MonthlyStats)
c.Start()
select {}
}

0 comments on commit 231caf4

Please sign in to comment.