Opened 3 years ago

Closed 18 months ago

#3840 closed enhancement (fixed)

Lobby - don't send redundant rating requests

Reported by: elexis Owned by:
Priority: Nice to Have Milestone: Alpha 22
Component: Multiplayer lobby Keywords:
Cc: Patch:

Description (last modified by elexis)

Currently there are a lot of useless requests for player-profiles done. For example when clicking on the same user twice or changing the sort order of the playerlist in the lobby, the viewed profile will be reloaded.

But since the ratings didn't change, the profile will be identical. Thus it can just as well be cached and the cache cleaned once any rating changed.

It should be sufficient to operate on lobby.js, but feel free to ask on IRC for further information (see wiki:GettingStartedProgrammers)!

Change History (2)

comment:1 Changed 18 months ago by elexis

Description: modified (diff)
Keywords: simple removed

Phab:D688 for fixing the early return committed in r17924, thus fixing the issue described in the ticket.

Caching could, and probably should, still be done, so that it doesn't have to be releoaded when selecting different players back and forth. However that should be done at the C++ level. Perhaps it could even be changed so that the stats of the entire playerlist are sent and then only updates in case of rated 1v1s being played.

comment:2 Changed 18 months ago by elexis

Milestone: BacklogAlpha 22
Resolution: fixed
Status: newclosed
Summary: Lobby - cache player profilesLobby - don't send redundant rating requests

In r19841:

JS lobby cleanup, fixes and lobby bot performance improvements:

Do not send a wasteful rating request if the same player is selected again when someone joined the lobby, when changing the sorting order or when clicking on the same user again by moving the player-selection change test from updatePlayerList to onPlayerListSelection.

That test should have been done here in rP17924 already and fixes #3840 well enough.

This change also fixes an unintentional behavior of the code, where the game the currently selected player is playing in would be selected if someone else joined the lobby, even if a different game was selected manually. Furthermore it allows simplification of the code of rP19287 by removing selectGameFromPlayername which did almost the same as selectGameFromPlayername.

To still select the game the current player is playing in if the selected player didn't change, subscribe to the (new) event that is called when clicking on an item.

Differential Revision: ​https://code.wildfiregames.com/D688 Reviewed By: ffffffff (fpre)

Note: See TracTickets for help on using tickets.