Skip to content

Commit

Permalink
restore to working with redis.v5
Browse files Browse the repository at this point in the history
  • Loading branch information
SergeyTsalkov committed Feb 23, 2017
1 parent e07dc90 commit 8c55fc0
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/brooce/heartbeat/heartbeat.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ func auditHeartbeats() {
keyMatch := fmt.Sprintf("%s:workerprocs:%v-*", config.Config.ClusterName, myip.PublicIPv4())
var keys []string
keys, err = redisClient.Keys(keyMatch).Result()
if err != nil {
if err != nil || len(keys) == 0 {
return
}

Expand Down
2 changes: 1 addition & 1 deletion src/brooce/listing/crons.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ func crons(disabled bool) (crons map[string]*cron.CronType, err error) {
}

keys, err = redisClient.Keys(cronKeyPrefix + "*").Result()
if err != nil {
if err != nil || len(keys) == 0 {
return
}

Expand Down
2 changes: 1 addition & 1 deletion src/brooce/listing/runningjobs.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ func RunningJobs() (jobs []*task.Task, err error) {

var keys []string
keys, err = redisClient.Keys(redisHeader + ":queue:*:working:*").Result()
if err != nil {
if err != nil || len(keys) == 0 {
return
}

Expand Down
2 changes: 1 addition & 1 deletion src/brooce/listing/runningworkers.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
func RunningWorkers() (workers []*heartbeat.HeartbeatType, err error) {
var keys []string
keys, err = redisClient.Keys(redisHeader + ":workerprocs:*").Result()
if err != nil {
if err != nil || len(keys) == 0 {
return
}

Expand Down
5 changes: 5 additions & 0 deletions src/brooce/web/joblist.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,11 @@ func (output *joblistOutputType) listJobs(reverse bool) (err error) {

rangeLength := len(rangeResult.Val())
output.Jobs = make([]*task.Task, rangeLength)

if len(output.Jobs) == 0 {
return
}

for i, value := range rangeResult.Val() {
job, err := task.NewFromJson(value)
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion src/brooce/web/mainpage.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func listQueues(runningWorkers []*heartbeat.HeartbeatType) (list map[string]*lis
list = map[string]*listQueueType{}
var results []string
results, err = redisClient.Keys(redisHeader + ":queue:*").Result()
if err != nil {
if err != nil || len(results) == 0 {
return
}

Expand Down

0 comments on commit 8c55fc0

Please sign in to comment.