mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-23 19:49:50 +02:00
fix: parrellel safe changes
This commit is contained in:
1 parent
2fffd512ac
commit
6e8fdcfeef
2 files changed
+12
-9
No files matched your search
@@ -134,8 +134,6 @@ namespace BlitzKit.CLI.Functions
|
|||||||
|
|
||||||
// MangleHull(id, pda);
|
// MangleHull(id, pda);
|
||||||
|
|
||||||
Console.WriteLine(slug);
|
|
||||||
|
|
||||||
Tank tank = new()
|
Tank tank = new()
|
||||||
{
|
{
|
||||||
Id = id,
|
Id = id,
|
||||||
|
|||||||
@@ -1,3 +1,4 @@
|
|||||||
|
using System.Collections.Concurrent;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
using BlitzKit.CLI.Utils;
|
using BlitzKit.CLI.Utils;
|
||||||
@@ -41,7 +42,8 @@ namespace BlitzKit.CLI.Models
|
|||||||
{
|
{
|
||||||
Credentials = new(Env.GetString("GH_TOKEN")),
|
Credentials = new(Env.GetString("GH_TOKEN")),
|
||||||
};
|
};
|
||||||
List<FileChange> changes = [];
|
var seenPaths = new ConcurrentDictionary<string, bool>();
|
||||||
|
var changes = new ConcurrentBag<FileChange>(); // Thread-safe alternative
|
||||||
|
|
||||||
await Task.WhenAll(
|
await Task.WhenAll(
|
||||||
changesRaw
|
changesRaw
|
||||||
@@ -55,16 +57,19 @@ namespace BlitzKit.CLI.Models
|
|||||||
|
|
||||||
if (response.StatusCode == HttpStatusCode.NotFound)
|
if (response.StatusCode == HttpStatusCode.NotFound)
|
||||||
{
|
{
|
||||||
Console.WriteLine(
|
if (seenPaths.TryAdd(change.Path, true)) // Ensures uniqueness
|
||||||
$"🟢 (+{change.Content.Count.ToString("N0", Program.Culture)}B) {blobPath}"
|
{
|
||||||
);
|
Console.WriteLine(
|
||||||
changes.Add(change);
|
$"🟢 (+{change.Content.Count.ToString("N0", Program.Culture)}B) {blobPath}"
|
||||||
|
);
|
||||||
|
changes.Add(change);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (response.StatusCode == HttpStatusCode.OK)
|
else if (response.StatusCode == HttpStatusCode.OK)
|
||||||
{
|
{
|
||||||
var bytes = await response.Content.ReadAsByteArrayAsync();
|
var bytes = await response.Content.ReadAsByteArrayAsync();
|
||||||
|
|
||||||
if (!bytes.SequenceEqual([.. change.Content]))
|
if (!bytes.SequenceEqual([.. change.Content]) && seenPaths.TryAdd(change.Path, true))
|
||||||
{
|
{
|
||||||
var diff = change.Content.Count - bytes.Length;
|
var diff = change.Content.Count - bytes.Length;
|
||||||
|
|
||||||
@@ -83,7 +88,7 @@ namespace BlitzKit.CLI.Models
|
|||||||
.ToList()
|
.ToList()
|
||||||
);
|
);
|
||||||
|
|
||||||
if (changes.Count == 0)
|
if (changes.IsEmpty)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var repoRawSplit = repoRaw.Split('/');
|
var repoRawSplit = repoRaw.Split('/');
|
||||||
|
|||||||
Reference in new issue
Block a user