Do you see any issues with the following code possibly spamming the API infinitely?
public async Task<ApiGameplayItem[]> GetGameplayItemsAsync(ISession session, CancellationToken canceller = default)
{
List<ApiGameplayItem> items = new();
string cursor = null;
while (true)
{
IApiStorageObjectList itemObjs = await _client.ListStorageObjectsAsync(session, "econ_gameplay_items", limit: 100, cursor);
foreach (IApiStorageObject obj in itemObjs.Objects)
{
try
{
items.Add(obj.Value.FromJson<ApiGameplayItem>());
}
catch (Exception e)
{
Log.Error(LogChannel.API, $"{nameof(GetGameplayItemsAsync)}: Failed to parse ApiGameplayItem", e, new Dictionary<string, object> {
{ "itemID", obj.Key }
});
}
}
if (itemObjs.Cursor == null)
break;
cursor = itemObjs.Cursor;
}
return items.ToArray();
}
We’re seeing some weirly spiky high loads that seem quite random. I have a hunch it’s this but can’t see what might be wrong here.