1
0
Fork 0
mirror of https://github.com/eosswedenorg/thalos synced 2026-06-17 04:30:03 +02:00

ship_processor.go: Use publisher instead of redis directly.

This commit is contained in:
Henrik Hautakoski 2023-01-13 13:33:01 +01:00
parent eec834a338
commit d0782c3c7c

View file

@ -36,7 +36,7 @@ func encodeMessage(v interface{}) ([]byte, bool) {
func queueMessage(channel redis.ChannelInterface, payload []byte) bool {
key := redisNs.NewKey(channel)
err := redis.RegisterPublish(key.String(), payload).Err()
err := publisher.Publish(key.String(), payload)
if err != nil {
log.WithError(err).Errorf("Failed to post to channel '%s'", key)
return false
@ -67,9 +67,9 @@ func processBlock(block *ship.GetBlocksResultV0) {
encodeQueue(redis.HeartbeatChannel, hb)
_, err := redis.Send()
err := publisher.Flush()
if err != nil {
log.WithError(err).Error("Failed to send redis")
log.WithError(err).Error("Failed to send messages")
}
}
}
@ -120,8 +120,8 @@ func processTraces(traces []*ship.TransactionTraceV0) {
}
}
_, err := redis.Send()
err := publisher.Flush()
if err != nil {
log.WithError(err).Error("Failed to send redis")
log.WithError(err).Error("Failed to send messages")
}
}