Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Commit

Permalink
return emtoy consumer slice from stor instead
Browse files Browse the repository at this point in the history
  • Loading branch information
magnushoerberg committed Feb 1, 2021
1 parent 70adc78 commit 8584c02
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
5 changes: 0 additions & 5 deletions server/api/consumers.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import (
"net/http"
"sort"

"github.com/cloudkarafka/cloudkarafka-manager/config"
mw "github.com/cloudkarafka/cloudkarafka-manager/server/middleware"
"github.com/cloudkarafka/cloudkarafka-manager/store"
"goji.io/pat"
Expand All @@ -16,10 +15,6 @@ func ListConsumerGroups(w http.ResponseWriter, r *http.Request) {
http.Error(w, "Unauthorized", http.StatusUnauthorized)
return
}
if config.NoConsumers {
writeAsJson(w, Page(1, 1, store.ConsumerSlice{}))
return
}
ps, p, err := pageInfo(r)
if err != nil {
http.Error(w, err.Error(), http.StatusBadRequest)
Expand Down
4 changes: 4 additions & 0 deletions store/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"sync"
"time"

"github.com/cloudkarafka/cloudkarafka-manager/config"
humanize "github.com/dustin/go-humanize"
)

Expand Down Expand Up @@ -174,6 +175,9 @@ func (me storage) SumBrokerSeries(metric string) TimeSerie {
}

func (me storage) Consumers() ConsumerSlice {
if config.NoConsumers {
return ConsumerSlice{}
}
me.RLock()
defer me.RUnlock()
var (
Expand Down

0 comments on commit 8584c02

Please sign in to comment.