From 7252ea120bd2e63ca7206f1f71bb9f26248b777b Mon Sep 17 00:00:00 2001 From: winlin Date: Thu, 29 Aug 2024 17:21:11 +0800 Subject: [PATCH] Use memory LB for simple use scenarios. --- proxy/env.go | 6 +++--- proxy/srs.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/proxy/env.go b/proxy/env.go index 7314c42d41c..42b278d23a4 100644 --- a/proxy/env.go +++ b/proxy/env.go @@ -8,10 +8,10 @@ import ( "os" "path" + "github.com/joho/godotenv" + "srs-proxy/errors" "srs-proxy/logger" - - "github.com/joho/godotenv" ) // loadEnvFile loads the environment variables from file. Note that we only use .env file. @@ -48,7 +48,7 @@ func setupDefaultEnv(ctx context.Context) { setEnvDefault("PROXY_SYSTEM_API", "12025") // The load balancer, use redis or memory. - setEnvDefault("PROXY_LOAD_BALANCER_TYPE", "redis") + setEnvDefault("PROXY_LOAD_BALANCER_TYPE", "memory") // The redis server host. setEnvDefault("PROXY_REDIS_HOST", "127.0.0.1") // The redis server port. diff --git a/proxy/srs.go b/proxy/srs.go index 1c005c300b4..9fe284c75e5 100644 --- a/proxy/srs.go +++ b/proxy/srs.go @@ -155,7 +155,7 @@ func (v *srsMemoryLoadBalancer) Initialize(ctx context.Context) error { if err := v.Update(ctx, server); err != nil { return errors.Wrapf(err, "update default SRS %+v", server) } - logger.Df(ctx, "Initialize default SRS media server, %+v", server) + logger.Df(ctx, "MemoryLB: Initialize default SRS media server, %+v", server) } return nil } @@ -224,7 +224,7 @@ func (v *srsRedisLoadBalancer) Initialize(ctx context.Context) error { if err := rdb.Ping(ctx).Err(); err != nil { return errors.Wrapf(err, "unable to connect to redis %v", rdb.String()) } - logger.Df(ctx, "connected to redis %v ok", rdb.String()) + logger.Df(ctx, "RedisLB: connected to redis %v ok", rdb.String()) if server, err := NewDefaultSRSForDebugging(); err != nil { return errors.Wrapf(err, "initialize default SRS") @@ -246,7 +246,7 @@ func (v *srsRedisLoadBalancer) Initialize(ctx context.Context) error { } } }() - logger.Df(ctx, "Initialize default SRS media server, %+v", server) + logger.Df(ctx, "RedisLB: Initialize default SRS media server, %+v", server) } return nil }