mirror of
https://github.com/eosswedenorg/thalos
synced 2026-06-16 04:24:56 +02:00
ship_processor.go: make queueMessage() accept an redis.ChannelInterface instead of redis.Key so we can call redisNs.NewKey() as late as possible.
This commit is contained in:
parent
93300f01ea
commit
723b0786cb
1 changed files with 3 additions and 3 deletions
|
|
@ -21,7 +21,8 @@ func encodeMessage(v interface{}) ([]byte, bool) {
|
|||
return payload, true
|
||||
}
|
||||
|
||||
func queueMessage(key redis.Key, payload []byte) bool {
|
||||
func queueMessage(channel redis.ChannelInterface, payload []byte) bool {
|
||||
key := redisNs.NewKey(channel)
|
||||
err := redis.RegisterPublish(key.String(), payload).Err()
|
||||
if err != nil {
|
||||
log.WithError(err).Errorf("Failed to post to channel '%s'", key)
|
||||
|
|
@ -32,7 +33,6 @@ func queueMessage(key redis.Key, payload []byte) bool {
|
|||
|
||||
func encodeQueue(channel redis.Channel, v interface{}) bool {
|
||||
if payload, ok := encodeMessage(v); ok {
|
||||
channel := redisNs.NewKey(channel)
|
||||
if queueMessage(channel, payload) {
|
||||
return true
|
||||
}
|
||||
|
|
@ -102,7 +102,7 @@ func processTraces(traces []*ship.TransactionTraceV0) {
|
|||
}
|
||||
|
||||
for _, channel := range channels {
|
||||
queueMessage(redisNs.NewKey(channel), payload)
|
||||
queueMessage(channel, payload)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue