Commit 6cfb291e authored by Andrei Mihu's avatar Andrei Mihu
Browse files

Ensure tournament creates always return existing config on repeated creates.

parent 652c2878
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -13,6 +13,7 @@ The format is based on [keep a changelog](http://keepachangelog.com) and this pr
- Group create now returns HTTP 409 Conflict/GRPC Code 6 when group name is already in use.
- Allow Console API requests to return results above default size limit.
- Developer console presence count is no longer added together across nodes.
- Runtime create tournament calls always return any existing tournament after repeated calls with the same ID.

### Fixed
- Correctly handle errors when concurrently writing new storage objects.
+4 −1
Original line number Diff line number Diff line
@@ -164,7 +164,10 @@ func StartApiServer(logger *zap.Logger, startupLogger *zap.Logger, db *sql.DB, j
	}
	dialOpts := []grpc.DialOption{
		//TODO (mo, zyro): Do we need to pass the statsHandler here as well?
		grpc.WithDefaultCallOptions(grpc.MaxCallSendMsgSize(int(config.GetSocket().MaxMessageSizeBytes))),
		grpc.WithDefaultCallOptions(
			grpc.MaxCallSendMsgSize(int(config.GetSocket().MaxMessageSizeBytes)),
			grpc.MaxCallRecvMsgSize(1024*1024*128),
		),
		grpc.WithStatsHandler(&ocgrpc.ClientHandler{}),
	}
	if config.GetSocket().TLSCert != nil {
+2 −2
Original line number Diff line number Diff line
@@ -339,9 +339,9 @@ func (l *LocalLeaderboardCache) CreateTournament(ctx context.Context, id string,
	leaderboard := l.leaderboards[id]
	l.RUnlock()
	if leaderboard != nil {
		if leaderboard.Duration > 0 {
		if leaderboard.IsTournament() {
			// Creation is an idempotent operation.
			return nil, nil // return nil for leaderboard to indicate no new creation
			return leaderboard, nil
		}
		l.logger.Error("Cannot create tournament as leaderboard is already in use.", zap.String("leaderboard_id", id))
		return nil, fmt.Errorf("cannot create tournament as leaderboard is already in use")