Skip to content

Commit

Permalink
Use memory LB for simple use scenarios.
Browse files Browse the repository at this point in the history
  • Loading branch information
winlinvip committed Aug 29, 2024
1 parent 985347a commit 7252ea1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions proxy/env.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down Expand Up @@ -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.
Expand Down
6 changes: 3 additions & 3 deletions proxy/srs.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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")
Expand All @@ -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
}
Expand Down

0 comments on commit 7252ea1

Please sign in to comment.