SmrSession: allow active session for each game #368
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add a new method
SmrSession::updateGame
, which changes thegame_id
, but also ensures that active sessions are unique foreach (account_id, game_id) pair.
This allows players to have multiple games open for the same
account (though in different browsers, due to the nature of the
browser cookies).
This is also an important step towards integrating multis into
the same account as the main.
Prerequisite commit
SmrSession: remove LIMIT 1 from deletion
One possible solution to (or mitigation of) the infrequent mysql error:
is to remove the
LIMIT 1
qualifier from the deletion that directlyprecedes the INSERT that is causing this error.
The reason this may help is because certain incompletely understood
race conditions might result in an account having two active sessions.
Then when this deletion comes along, it removes one but not both of
these sessions. It is unclear why the primary keys would be identical.
The
active_session
table is small (due to pruning inactive sessions),so having to process the entire table when creating a new session is
not going to impact performance at all.