Skip to content

Commit

Permalink
Fix multi-request publish start not checking ForkID for duplicate pub…
Browse files Browse the repository at this point in the history
…lishes.
  • Loading branch information
PJB3005 committed Sep 22, 2024
1 parent 82109bc commit 1ab0503
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Robust.Cdn/Controllers/ForkPublishController.Multi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ public async Task<IActionResult> MultiPublishStart(

logger.LogInformation("Starting multi publish for fork {Fork} version {Version}", fork, request.Version);

var forkId = dbCon.QuerySingle<int>("SELECT Id FROM Fork WHERE Name = @Name", new { Name = fork });
var hasExistingPublish = dbCon.QuerySingleOrDefault<bool>(
"SELECT 1 FROM PublishInProgress WHERE Version = @Version ",
new { request.Version });
"SELECT 1 FROM PublishInProgress WHERE Version = @Version AND ForkId = @ForkId",
new { request.Version, ForkId = forkId });
if (hasExistingPublish)
{
// If a publish with this name already exists we abort it and start again.
Expand All @@ -44,8 +45,6 @@ public async Task<IActionResult> MultiPublishStart(
publishManager.AbortMultiPublish(fork, request.Version, tx, commit: false);
}

var forkId = dbCon.QuerySingle<int>("SELECT Id FROM Fork WHERE Name = @Name", new { Name = fork });

await dbCon.ExecuteAsync("""
INSERT INTO PublishInProgress (Version, ForkId, StartTime, EngineVersion)
VALUES (@Version, @ForkId, @StartTime, @EngineVersion)
Expand Down

0 comments on commit 1ab0503

Please sign in to comment.