Removed ticket auto-expiring logic from statestore (#1146)

This commit is contained in:
yfei1
2020-03-06 17:20:49 -08:00
committed by GitHub
parent bca6f487cc
commit 7a4aa3589f
3 changed files with 1 additions and 38 deletions

View File

@ -103,7 +103,6 @@ data:
maxActive: {{ index .Values "open-match-core" "redis" "pool" "maxActive" }}
idleTimeout: {{ index .Values "open-match-core" "redis" "pool" "idleTimeout" }}
healthCheckTimeout: {{ index .Values "open-match-core" "redis" "pool" "healthCheckTimeout" }}
expiration: 43200
telemetry:
zpages:

View File

@ -161,15 +161,6 @@ func (rb *redisBackend) CreateTicket(ctx context.Context, ticket *pb.Ticket) err
}
defer handleConnectionClose(&redisConn)
err = redisConn.Send("MULTI")
if err != nil {
redisLogger.WithFields(logrus.Fields{
"cmd": "MULTI",
"error": err.Error(),
}).Error("state storage operation failed")
return status.Errorf(codes.Internal, "%v", err)
}
value, err := proto.Marshal(ticket)
if err != nil {
redisLogger.WithFields(logrus.Fields{
@ -179,7 +170,7 @@ func (rb *redisBackend) CreateTicket(ctx context.Context, ticket *pb.Ticket) err
return status.Errorf(codes.Internal, "%v", err)
}
err = redisConn.Send("SET", ticket.GetId(), value)
_, err = redisConn.Do("SET", ticket.GetId(), value)
if err != nil {
redisLogger.WithFields(logrus.Fields{
"cmd": "SET",
@ -189,32 +180,6 @@ func (rb *redisBackend) CreateTicket(ctx context.Context, ticket *pb.Ticket) err
return status.Errorf(codes.Internal, "%v", err)
}
if rb.cfg.IsSet("redis.expiration") {
redisTTL := rb.cfg.GetInt("redis.expiration")
if redisTTL > 0 {
err = redisConn.Send("EXPIRE", ticket.GetId(), redisTTL)
if err != nil {
redisLogger.WithFields(logrus.Fields{
"cmd": "EXPIRE",
"key": ticket.GetId(),
"ttl": redisTTL,
"error": err.Error(),
}).Error("failed to set ticket expiration in state storage")
return status.Errorf(codes.Internal, "%v", err)
}
}
}
_, err = redisConn.Do("EXEC")
if err != nil {
redisLogger.WithFields(logrus.Fields{
"cmd": "EXEC",
"key": ticket.GetId(),
"error": err.Error(),
}).Error("failed to create ticket in state storage")
return status.Errorf(codes.Internal, "%v", err)
}
return nil
}

View File

@ -335,7 +335,6 @@ func createRedis(t *testing.T) (config.View, func()) {
cfg.Set("redis.pool.idleTimeout", time.Second)
cfg.Set("redis.pool.healthCheckTimeout", 100*time.Millisecond)
cfg.Set("redis.pool.maxActive", 1000)
cfg.Set("redis.expiration", 42000)
cfg.Set("storage.ignoreListTTL", "200ms")
cfg.Set("backoff.initialInterval", 100*time.Millisecond)
cfg.Set("backoff.randFactor", 0.5)