Pubsub fix

This commit is contained in:
2024-04-09 12:04:40 -06:00
parent b1714d8ec5
commit f010a88530
2 changed files with 8 additions and 11 deletions

View File

@ -21,9 +21,9 @@ type RedisPubSub struct {
Client *redis.Client
}
func NewRedisClient() *redis.Client {
func NewRedisClient() (*redis.Client, error) {
if RedisClient != nil {
return RedisClient
return RedisClient, nil
}
godotenv.Load(".env")
@ -32,13 +32,13 @@ func NewRedisClient() *redis.Client {
opts, err := redis.ParseURL(redis_url)
if err != nil {
return nil
return nil, err
}
lib.LogInfo.Printf("\n[PUBSUB/REDIS]Connecting to Redis at %s\n", opts.Addr)
RedisClient = redis.NewClient(opts)
return RedisClient
return RedisClient, nil
}
func (m *RedisPubSubMessage) ReceiveMessage(ctx context.Context) (*pubsub.Message, error) {