mirror of
https://github.com/eosswedenorg/thalos
synced 2026-07-03 11:53:41 +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
|
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()
|
err := redis.RegisterPublish(key.String(), payload).Err()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithError(err).Errorf("Failed to post to channel '%s'", key)
|
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 {
|
func encodeQueue(channel redis.Channel, v interface{}) bool {
|
||||||
if payload, ok := encodeMessage(v); ok {
|
if payload, ok := encodeMessage(v); ok {
|
||||||
channel := redisNs.NewKey(channel)
|
|
||||||
if queueMessage(channel, payload) {
|
if queueMessage(channel, payload) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
@ -102,7 +102,7 @@ func processTraces(traces []*ship.TransactionTraceV0) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, channel := range channels {
|
for _, channel := range channels {
|
||||||
queueMessage(redisNs.NewKey(channel), payload)
|
queueMessage(channel, payload)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue