Add redis pub/sub support.

This commit is contained in:
Naoki Kosaka
2019-07-28 18:43:50 +09:00
parent 6c0d51f57c
commit 17394e7e40
7 changed files with 57 additions and 15 deletions

View File

@ -58,7 +58,7 @@ func initConfig() {
panic(err)
}
redisClient := redis.NewClient(redisOption)
relayState = state.NewState(redisClient)
relayState = state.NewState(redisClient, true)
var machineryConfig = &config.Config{
Broker: viper.GetString("redis_url"),
DefaultQueue: "relay",

View File

@ -5,12 +5,14 @@ import (
"testing"
"github.com/spf13/viper"
state "github.com/yukimochi/Activity-Relay/State"
)
func TestMain(m *testing.M) {
viper.Set("actor_pem", "../misc/testKey.pem")
viper.Set("relay_domain", "relay.yukimochi.example.org")
initConfig()
relayState = state.NewState(relayState.RedisClient, false)
relayState.RedisClient.FlushAll().Result()
code := m.Run()