Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 33 additions & 8 deletions Knossos.NET/Models/Nebula.cs
Original file line number Diff line number Diff line change
Expand Up @@ -715,7 +715,10 @@ private struct ApiReply

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool done { get; set; }


[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool gatewayTimeout { get; set; }

[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public Mod mod { get; set; }
}
Expand Down Expand Up @@ -815,14 +818,21 @@ private enum ApiMethod
}
}
data.Dispose();
/* Upload/Update/delete Mod Timeout Hack */
if(response.StatusCode.ToString() == "GatewayTimeout" && (resourceUrl == "mod/release" || resourceUrl == "mod/release/update" || resourceUrl == "mod/release/delete" || resourceUrl == "multiupload/finish"))
if (response.StatusCode == System.Net.HttpStatusCode.GatewayTimeout)
{
Log.Add(Log.LogSeverity.Warning, "Nebula.ApiCall(" + resourceUrl + ")", "A GatewayTimeout was received. This is a known issue with Nebula and while Knet handles this" +
" as a success there is not an actual way to know if the api call was really successfull.");
var reply = new ApiReply();
reply.result = true;
return reply;
if (resourceUrl == "multiupload/finish")
{
/* Finish() has retry + CheckUploadDone() verification for null replies — let it handle this */
Log.Add(Log.LogSeverity.Warning, "Nebula.ApiCall(" + resourceUrl + ")", "A GatewayTimeout was received. Returning null so Finish() can verify server state.");
return null;
}
if (resourceUrl == "mod/release" || resourceUrl == "mod/release/update" || resourceUrl == "mod/release/delete")
{
Log.Add(Log.LogSeverity.Warning, "Nebula.ApiCall(" + resourceUrl + ")", "A GatewayTimeout was received. Operation status is unknown — the server may have processed the request after the proxy timed out.");
var reply = new ApiReply();
reply.gatewayTimeout = true;
return reply;
}
}
}
Log.Add(Log.LogSeverity.Error, "Nebula.ApiCall(" + resourceUrl + ")", "An error has ocurred during nebula api POST call: " + response.StatusCode + "(" + (int)response.StatusCode + ")");
Expand Down Expand Up @@ -1433,6 +1443,11 @@ public static async Task<bool> IsModEditable(string id)
Log.Add(Log.LogSeverity.Information, "Nebula.DeleteModVersion", "Deleted mod/version : " + mod + " from Nebula.");
return "ok";
}
else if (reply.Value.gatewayTimeout)
{
Log.Add(Log.LogSeverity.Warning, "Nebula.DeleteModVersion", "Server timed out. The deletion may or may not have succeeded. Please verify on the Nebula website.");
return "Server timed out — please verify the deletion on the Nebula website.";
}
else
{
Log.Add(Log.LogSeverity.Error, "Nebula.DeleteModVersion", "Error while deleting mod/version: " + mod + " Reason: " + reply.Value.reason);
Expand Down Expand Up @@ -1694,6 +1709,11 @@ public static async Task<bool> IsFileUploaded(string? checksum = null, string? c
Log.Add(Log.LogSeverity.Information, "Nebula.ReleaseMod", "ReleaseMod: " + mod + " OK!");
return "ok";
}
else if (reply.Value.gatewayTimeout)
{
Log.Add(Log.LogSeverity.Warning, "Nebula.ReleaseMod", "Server timed out. The release may or may not have succeeded. Please verify on the Nebula website.");
return "Server timed out — please verify the release on the Nebula website.";
}
else
{
Log.Add(Log.LogSeverity.Error, "Nebula.ReleaseMod", "ReleaseMod: " + mod + " error. Reason: " + reply.Value.reason);
Expand Down Expand Up @@ -1730,6 +1750,11 @@ public static async Task<bool> IsFileUploaded(string? checksum = null, string? c
Log.Add(Log.LogSeverity.Information, "Nebula.UpdateMetaData", "UpdateMetaData: " + mod + " OK!");
return "ok";
}
else if (reply.Value.gatewayTimeout)
{
Log.Add(Log.LogSeverity.Warning, "Nebula.UpdateMetaData", "Server timed out. The metadata update may or may not have succeeded. Please verify on the Nebula website.");
return "Server timed out — please verify the metadata update on the Nebula website.";
}
else
{
Log.Add(Log.LogSeverity.Error, "Nebula.UpdateMetaData", "UpdateMetaData: " + mod + " error. Reason: " + reply.Value.reason);
Expand Down