diff --git a/src/Tgstation.Server.Host/Components/Repository/Repository.cs b/src/Tgstation.Server.Host/Components/Repository/Repository.cs
index f36ede80e6..55603a08d4 100644
--- a/src/Tgstation.Server.Host/Components/Repository/Repository.cs
+++ b/src/Tgstation.Server.Host/Components/Repository/Repository.cs
@@ -111,55 +111,6 @@ namespace Tgstation.Server.Host.Components.Repository
///
bool disposed;
- ///
- /// Converts a given to a .
- ///
- /// The of the operation.
- /// The stage argument for .
- /// A based on .
- static CheckoutProgressHandler CheckoutProgressHandler(JobProgressReporter progressReporter, string stage) => (a, completedSteps, totalSteps) =>
- {
- int? percentage;
- if (totalSteps > completedSteps || totalSteps == 0)
- percentage = null;
- else
- {
- var ratio = ((float)completedSteps) / totalSteps;
- percentage = (int)(ratio * 100);
- if (percentage < 0)
- percentage = null;
- }
-
- progressReporter(
- stage,
- percentage);
- };
-
- ///
- /// Generate a from a given and .
- ///
- /// The of the operation.
- /// The stage argument for .
- /// The for the operation.
- /// A new based on .
- static TransferProgressHandler TransferProgressHandler(JobProgressReporter progressReporter, string stage, CancellationToken cancellationToken) => (transferProgress) =>
- {
- float? percentage;
- var totalObjectsToProcess = transferProgress.TotalObjects * 2;
- var processedObjects = transferProgress.IndexedObjects + transferProgress.ReceivedObjects;
- if (totalObjectsToProcess > processedObjects || totalObjectsToProcess == 0)
- percentage = null;
- else
- {
- percentage = 100 * (((float)processedObjects) / totalObjectsToProcess);
- if (percentage < 0)
- percentage = null;
- }
-
- progressReporter(stage, (int?)percentage);
- return !cancellationToken.IsCancellationRequested;
- };
-
///
/// Rethrow the authentication failure message as a if it is one.
///
@@ -1059,5 +1010,67 @@ namespace Tgstation.Server.Host.Components.Repository
await eventConsumer.HandleEvent(EventType.RepoSubmoduleUpdate, new List { submodule.Name }, cancellationToken).ConfigureAwait(false);
}
}
+
+ ///
+ /// Converts a given to a .
+ ///
+ /// The of the operation.
+ /// The stage argument for .
+ /// A based on .
+ CheckoutProgressHandler CheckoutProgressHandler(JobProgressReporter progressReporter, string stage) => (a, completedSteps, totalSteps) =>
+ {
+ int? percentage;
+ if (totalSteps > completedSteps || totalSteps == 0)
+ percentage = null;
+ else
+ {
+ var ratio = ((float)completedSteps) / totalSteps;
+ percentage = (int)(ratio * 100);
+ if (percentage < 0)
+ percentage = null;
+ }
+
+ if (percentage == null)
+ logger.LogDebug(
+ "Bad checkout progress values (Please tell Cyberboss)! Completeds: {completed}, Total: {total}",
+ completedSteps,
+ totalSteps);
+
+ progressReporter(
+ stage,
+ percentage);
+ };
+
+ ///
+ /// Generate a from a given and .
+ ///
+ /// The of the operation.
+ /// The stage argument for .
+ /// The for the operation.
+ /// A new based on .
+ TransferProgressHandler TransferProgressHandler(JobProgressReporter progressReporter, string stage, CancellationToken cancellationToken) => (transferProgress) =>
+ {
+ float? percentage;
+ var totalObjectsToProcess = transferProgress.TotalObjects * 2;
+ var processedObjects = transferProgress.IndexedObjects + transferProgress.ReceivedObjects;
+ if (totalObjectsToProcess > processedObjects || totalObjectsToProcess == 0)
+ percentage = null;
+ else
+ {
+ percentage = 100 * (((float)processedObjects) / totalObjectsToProcess);
+ if (percentage < 0)
+ percentage = null;
+ }
+
+ if (percentage == null)
+ logger.LogDebug(
+ "Bad transfer progress values (Please tell Cyberboss)! Indexed: {indexed}, Received: {received}, Total: {total}",
+ transferProgress.IndexedObjects,
+ transferProgress.ReceivedObjects,
+ transferProgress.TotalObjects);
+
+ progressReporter(stage, (int?)percentage);
+ return !cancellationToken.IsCancellationRequested;
+ };
}
}