reduce game token lifetime
This commit is contained in:
@@ -4,7 +4,7 @@ class JwtService
|
|||||||
EXPIRATION = 7.days
|
EXPIRATION = 7.days
|
||||||
|
|
||||||
def self.encode(payload)
|
def self.encode(payload)
|
||||||
payload[:exp] = EXPIRATION.from_now.to_i
|
payload[:exp] = EXPIRATION.from_now.to_i if payload[:exp] == nil
|
||||||
JWT.encode(payload, SECRET_KEY, ALGORITHM)
|
JWT.encode(payload, SECRET_KEY, ALGORITHM)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -99,14 +99,14 @@ class MatchmakingService
|
|||||||
player1_id: player1_id,
|
player1_id: player1_id,
|
||||||
player2_id: player2_id,
|
player2_id: player2_id,
|
||||||
game_server: GAME_SERVER,
|
game_server: GAME_SERVER,
|
||||||
exp: 1.hour.from_now.to_i
|
exp: 2.minute.from_now.to_i
|
||||||
)
|
)
|
||||||
|
|
||||||
match_data = {
|
match_data = {
|
||||||
match_id: match_id,
|
match_id: match_id,
|
||||||
game_token: game_token,
|
game_token: game_token,
|
||||||
game_server: GAME_SERVER,
|
game_server: GAME_SERVER,
|
||||||
players: [player1_id, player2_id]
|
players: [ player1_id, player2_id ]
|
||||||
}
|
}
|
||||||
|
|
||||||
# Store match data for both players
|
# Store match data for both players
|
||||||
|
|||||||
Reference in New Issue
Block a user