Skip to content

Commit

Permalink
Added check serverRes return type
Browse files Browse the repository at this point in the history
  • Loading branch information
GreepTheSheep committed Aug 12, 2024
1 parent 74a67e2 commit 0f5cf3d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/Utils/RMC/RMCLeaderboard.as
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ namespace RMCLeaderAPI {

Json::Value@ serverRes = API::PostAsync(PluginSettings::RMC_Leaderboard_Url + "/api/rmc.php", Json::Write(serverJson));

if (serverRes.GetType() != Json::Type::Object) {
// failed, retry
Log::Warn("Posting RMC results failed. Retrying...");
sleep(5000);
RMCLeaderAPI::postRMC(goal, belowGoal, objective);
}

if (serverRes.HasKey("success")) {
bool isSuccess = serverRes["success"];
if (!isSuccess) {
Expand Down Expand Up @@ -130,6 +137,13 @@ namespace RMCLeaderAPI {

Json::Value@ serverRes = API::PostAsync(PluginSettings::RMC_Leaderboard_Url + "/api/rms.php", Json::Write(serverJson));

if (serverRes.GetType() != Json::Type::Object) {
// failed, retry
Log::Warn("Posting RMS results failed. Retrying...");
sleep(5000);
RMCLeaderAPI::postRMS(goal, skips, survivedTime, objective);
}

if (serverRes.HasKey("success")) {
bool isSuccess = serverRes["success"];
if (!isSuccess) {
Expand Down

0 comments on commit 0f5cf3d

Please sign in to comment.