Use lookup request in user lookup cache

Doing this alleviates https://github.com/ppy/osu/issues/29982, as the
currently online display utilises the user lookup cache, and currently
is hitting rate limits due to the amount of data retrieved from the `GET
/users` endpoint. Switching to `GET /users/lookup` reduces the chance of
this happening.
This commit is contained in:
Bartłomiej Dach 2024-10-08 14:05:27 +02:00
parent 3d06d67fec
commit 17bc5ce5a9
No known key found for this signature in database
1 changed files with 3 additions and 3 deletions

View File

@ -10,7 +10,7 @@
namespace osu.Game.Database namespace osu.Game.Database
{ {
public partial class UserLookupCache : OnlineLookupCache<int, APIUser, GetUsersRequest> public partial class UserLookupCache : OnlineLookupCache<int, APIUser, LookupUsersRequest>
{ {
/// <summary> /// <summary>
/// Perform an API lookup on the specified user, populating a <see cref="APIUser"/> model. /// Perform an API lookup on the specified user, populating a <see cref="APIUser"/> model.
@ -28,8 +28,8 @@ public partial class UserLookupCache : OnlineLookupCache<int, APIUser, GetUsersR
/// <returns>The populated users. May include null results for failed retrievals.</returns> /// <returns>The populated users. May include null results for failed retrievals.</returns>
public Task<APIUser?[]> GetUsersAsync(int[] userIds, CancellationToken token = default) => LookupAsync(userIds, token); public Task<APIUser?[]> GetUsersAsync(int[] userIds, CancellationToken token = default) => LookupAsync(userIds, token);
protected override GetUsersRequest CreateRequest(IEnumerable<int> ids) => new GetUsersRequest(ids.ToArray()); protected override LookupUsersRequest CreateRequest(IEnumerable<int> ids) => new LookupUsersRequest(ids.ToArray());
protected override IEnumerable<APIUser>? RetrieveResults(GetUsersRequest request) => request.Response?.Users; protected override IEnumerable<APIUser>? RetrieveResults(LookupUsersRequest request) => request.Response?.Users;
} }
} }