Skip to content

Commit

Permalink
fix: added SleepAfterImport to possibly address MERGE conflicts
Browse files Browse the repository at this point in the history
  • Loading branch information
chgl committed May 28, 2024
1 parent 302544a commit e16fd4a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/PathlingS3Import.Tests.E2E/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,6 @@ public async Task StartImportTool_WithRunningPathlingServerAndMinio_ShouldCreate
);

response.Should().NotBeNull();
response!.Total.Should().Be(5007);
response!.Total.Should().Be(50007);
}
}
11 changes: 11 additions & 0 deletions src/PathlingS3Import/Commands/ImportCommand.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System;
using System.Diagnostics;
using System.Reactive.Linq;
using System.Text;
Expand Down Expand Up @@ -79,6 +80,9 @@ public ImportCommand()
[CliOption(Description = "Name of the checkpoint file", Name = "--checkpoint-file-name")]
public string CheckpointFileName { get; set; } = "_last-import-checkpoint.json";

[CliOption(Description = "Delay to wait after importing a bundle")]
public TimeSpan SleepAfterImport { get; set; } = TimeSpan.FromSeconds(10);

public async Task RunAsync()
{
log.LogInformation(
Expand Down Expand Up @@ -425,6 +429,13 @@ await retryPipeline.ExecuteAsync(async token =>
importedCount,
objectsToProcessCount
);

log.LogInformation(
"Sleeping after import for {SleepAfterImportSeconds} s",
SleepAfterImport.TotalSeconds
);

await Task.Delay(SleepAfterImport);
}
}

Expand Down
3 changes: 2 additions & 1 deletion src/PathlingS3Import/Commands/MergeCommand.cs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
using System.Collections.Concurrent;
using System.Reactive.Linq;
using System.Text;
using System.Text.Json;
Expand Down Expand Up @@ -95,7 +96,7 @@ await minio.ListObjectsAsync(listArgs).ToList()
})
.ToList();

var currentMergedResources = new Dictionary<string, string>();
var currentMergedResources = new ConcurrentDictionary<string, string>();
var estimatedSizeInBytes = 0;
foreach (var item in objectsToProcess)
{
Expand Down

0 comments on commit e16fd4a

Please sign in to comment.