mirror of
https://github.com/ppy/osu.git
synced 2026-06-04 21:39:30 +08:00
Merge pull request #33263 from bdach/extensive-bss-logging
Add even more logging to beatmap submission process
This commit is contained in:
@@ -197,13 +197,22 @@ namespace osu.Game.Screens.Edit.Submission
|
||||
{
|
||||
bool beatmapHasOnlineId = Beatmap.Value.BeatmapSetInfo.OnlineID > 0;
|
||||
|
||||
var createRequest = beatmapHasOnlineId
|
||||
? PutBeatmapSetRequest.UpdateExisting(
|
||||
PutBeatmapSetRequest createRequest;
|
||||
|
||||
if (beatmapHasOnlineId)
|
||||
{
|
||||
createRequest = PutBeatmapSetRequest.UpdateExisting(
|
||||
(uint)Beatmap.Value.BeatmapSetInfo.OnlineID,
|
||||
Beatmap.Value.BeatmapSetInfo.Beatmaps.Where(b => b.OnlineID > 0).Select(b => (uint)b.OnlineID).ToArray(),
|
||||
(uint)Beatmap.Value.BeatmapSetInfo.Beatmaps.Count(b => b.OnlineID <= 0),
|
||||
settings)
|
||||
: PutBeatmapSetRequest.CreateNew((uint)Beatmap.Value.BeatmapSetInfo.Beatmaps.Count, settings);
|
||||
settings);
|
||||
log($"Updating existing beatmap set (id:{createRequest.BeatmapSetID} beatmapsToKeep:[{string.Join(",", createRequest.BeatmapsToKeep)}] beatmapsToCreate:{createRequest.BeatmapsToCreate})");
|
||||
}
|
||||
else
|
||||
{
|
||||
createRequest = PutBeatmapSetRequest.CreateNew((uint)Beatmap.Value.BeatmapSetInfo.Beatmaps.Count, settings);
|
||||
log($"Creating new beatmap set (beatmapsToCreate:{createRequest.BeatmapsToCreate})");
|
||||
}
|
||||
|
||||
createRequest.Success += async response =>
|
||||
{
|
||||
@@ -228,7 +237,7 @@ namespace osu.Game.Screens.Edit.Submission
|
||||
createRequest.Failure += ex =>
|
||||
{
|
||||
createSetStep.SetFailed(ex.Message);
|
||||
Logger.Log($"Beatmap set submission failed on creation: {ex}");
|
||||
log($"Beatmap set creation/update failed: {ex}");
|
||||
allowExit();
|
||||
};
|
||||
|
||||
@@ -257,7 +266,7 @@ namespace osu.Game.Screens.Edit.Submission
|
||||
{
|
||||
exportStep.SetFailed(ex.Message);
|
||||
exportProgressNotification = null;
|
||||
Logger.Log($"Beatmap set submission failed on export: {ex}");
|
||||
log($"Export failed: {ex}");
|
||||
allowExit();
|
||||
return;
|
||||
}
|
||||
@@ -277,6 +286,7 @@ namespace osu.Game.Screens.Edit.Submission
|
||||
{
|
||||
Debug.Assert(beatmapSetId != null);
|
||||
Debug.Assert(beatmapPackageStream != null);
|
||||
log("Determining list of files to patch...");
|
||||
|
||||
var onlineFilesByFilename = onlineFiles.ToDictionary(f => f.Filename, f => f.SHA2Hash);
|
||||
|
||||
@@ -291,12 +301,16 @@ namespace osu.Game.Screens.Edit.Submission
|
||||
|
||||
if (!onlineFilesByFilename.Remove(filename, out string? onlineHash))
|
||||
{
|
||||
log($@"new file: {filename}");
|
||||
filesToUpdate.Add(filename);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!localHash.Equals(onlineHash, StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
log($@"changed file: {filename} (localHash:{localHash} onlineHash:{onlineHash})");
|
||||
filesToUpdate.Add(filename);
|
||||
}
|
||||
}
|
||||
|
||||
var changedFiles = new Dictionary<string, byte[]>();
|
||||
@@ -307,11 +321,15 @@ namespace osu.Game.Screens.Edit.Submission
|
||||
var patchRequest = new PatchBeatmapPackageRequest(beatmapSetId.Value);
|
||||
patchRequest.FilesChanged.AddRange(changedFiles);
|
||||
patchRequest.FilesDeleted.AddRange(onlineFilesByFilename.Keys);
|
||||
|
||||
foreach (string file in patchRequest.FilesDeleted)
|
||||
log($@"deleted file: {file}");
|
||||
|
||||
patchRequest.Success += uploadCompleted;
|
||||
patchRequest.Failure += ex =>
|
||||
{
|
||||
uploadStep.SetFailed(ex.Message);
|
||||
Logger.Log($"Beatmap submission failed on upload: {ex}");
|
||||
log($"Upload failed: {ex}");
|
||||
allowExit();
|
||||
};
|
||||
patchRequest.Progressed += (current, total) => uploadStep.SetInProgress(total > 0 ? (float)current / total : null);
|
||||
@@ -322,6 +340,8 @@ namespace osu.Game.Screens.Edit.Submission
|
||||
|
||||
private void replaceBeatmapSet()
|
||||
{
|
||||
log("Peforming full package upload...");
|
||||
|
||||
Debug.Assert(beatmapSetId != null);
|
||||
Debug.Assert(beatmapPackageStream != null);
|
||||
|
||||
@@ -331,7 +351,7 @@ namespace osu.Game.Screens.Edit.Submission
|
||||
uploadRequest.Failure += ex =>
|
||||
{
|
||||
uploadStep.SetFailed(ex.Message);
|
||||
Logger.Log($"Beatmap submission failed on upload: {ex}");
|
||||
log($"Full package upload failed: {ex}");
|
||||
allowExit();
|
||||
};
|
||||
uploadRequest.Progressed += (current, total) => uploadStep.SetInProgress((float)current / Math.Max(total, 1));
|
||||
@@ -348,6 +368,8 @@ namespace osu.Game.Screens.Edit.Submission
|
||||
|
||||
private async Task updateLocalBeatmap()
|
||||
{
|
||||
log(@"Updating local beatmap set...");
|
||||
|
||||
Debug.Assert(beatmapSetId != null);
|
||||
Debug.Assert(beatmapPackageStream != null);
|
||||
|
||||
@@ -364,7 +386,7 @@ namespace osu.Game.Screens.Edit.Submission
|
||||
catch (Exception ex)
|
||||
{
|
||||
updateStep.SetFailed(ex.Message);
|
||||
Logger.Log($"Beatmap submission failed on local update: {ex}");
|
||||
log($@"Local update failed: {ex}");
|
||||
allowExit();
|
||||
return;
|
||||
}
|
||||
@@ -449,6 +471,9 @@ namespace osu.Game.Screens.Edit.Submission
|
||||
overlay.Show();
|
||||
}
|
||||
|
||||
private static void log(string message)
|
||||
=> Logger.Log($@"[{nameof(BeatmapSubmissionScreen)}] {message}", LoggingTarget.Database);
|
||||
|
||||
protected override void Dispose(bool isDisposing)
|
||||
{
|
||||
base.Dispose(isDisposing);
|
||||
|
||||
Reference in New Issue
Block a user