Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

changing backend redis library from v4 to v3 #19

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backends/pool.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"sync"
"time"

"gopkg.in/redis.v4"
"gopkg.in/redis.v3"
)

var once sync.Once
Expand Down
14 changes: 6 additions & 8 deletions backends/redis.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"time"

"gopkg.in/gilmour-libs/gilmour-e-go.v4/protocol"
"gopkg.in/redis.v4"
"gopkg.in/redis.v3"
)

const defaultErrorQueue = "gilmour.errorqueue"
Expand Down Expand Up @@ -180,7 +180,7 @@ func (r *Redis) Publish(topic string, message interface{}) (err error) {
func (r *Redis) ActiveIdents() (map[string]string, error) {
client := r.getClient()

return client.HGetAll(r.getHealthIdent()).Result()
return client.HGetAllMap(r.getHealthIdent()).Result()
}

func (r *Redis) RegisterIdent(uuid string) error {
Expand Down Expand Up @@ -209,13 +209,11 @@ func (r *Redis) setupListeners(sink chan<- *protocol.Message) {
for {
resp, _ := r.getPubSub().Receive()
switch v := resp.(type) {
case *redis.PMessage:
msg := &protocol.Message{"pmessage", v.Channel, v.Payload, v.Pattern}
sink <- msg
case *redis.Message:
var msg *protocol.Message
if v.Pattern == "" {
msg = &protocol.Message{"message", v.Channel, v.Payload, v.Channel}
} else {
msg = &protocol.Message{"pmessage", v.Channel, v.Payload, v.Pattern}
}
msg := &protocol.Message{"message", v.Channel, v.Payload, v.Channel}
sink <- msg
case *redis.Subscription:
//log.Println("PubSub event", "Channel", v.Channel, "Kind", v.Kind, "Count", v.Count)
Expand Down
4 changes: 2 additions & 2 deletions gilmour_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"testing"
"time"

"gopkg.in/gilmour-libs/gilmour-e-go.v4/backends"
"gopkg.in/gilmour-libs/gilmour-e-go.v4/ui"
"./backends"
"./ui"
)

const (
Expand Down