I'm having trouble using LoadRange. The problem is that I'm not seeing either of the results delegates ever being called and I'm not seeing any errors in the server logs. Here's some example code where I'm trying to load the top 10 most viewed game replays.
player.Send("ECHO", message.Type);
PlayerIO.BigDB.LoadRange("Replays", "ByViews", null, null, null, 10, delegate (DatabaseObject[] results) {
if (results == null) {
player.Send("REPLAYS_AVAILABLE", 0);
} else {
player.Send("THERE_ARE_REPLAYS");
Message response = Message.Create("AVAILABLE_REPLAYS");
response.Add(results.Length);
for (int scan = 0; scan < results.Length; scan++) {
if (results[scan] == null) {
continue;
}
response.Add(results[scan].Key);
response.Add(results[scan].GetString("Player"));
response.Add(results[scan].GetDateTime("Date").Ticks);
response.Add(results[scan].GetInt("Minerals"));
response.Add(results[scan].GetInt("Difficulty"));
response.Add(results[scan].GetInt("Map"));
}
player.Send(response);
}
}, delegate (PlayerIOError replay_error) {
// if this didn't work then check the email
player.Send("REPLAY_ERROR", replay_error.Message);
});
On the client I see the ECHO command but I never see any of the other messages. I've tried several other permutations using different indices, tables, and search criteria and am never seeing a message on my client. The only way I have gotten a response at all is by removing all of the code in the delegate and just sending a simple message. If I reference the results array though, I see no messages. I have no trouble using LoadSingle or LoadKeys. Any ideas on what might be going on or where to look next?