refactoring

This commit is contained in:
EugeneTes
2026-01-21 10:37:33 +01:00
parent cb231801f1
commit 5cef04bf92
11 changed files with 793 additions and 33 deletions

View File

@@ -73,15 +73,22 @@ public class PrinterQueue
try
{
// Call the actual print function
bool success = await _printService.PrintAsync(PrinterIp, job);
var result = await _printService.PrintAsync(PrinterIp, job);
if (!success)
if (!result.Success)
{
// Re-queue with retry logic
job.RetryCount++;
_logger.LogWarning("Job failed, retrying ({RetryCount}/3)", job.RetryCount);
await Task.Delay(5000, cancellationToken); // Wait before retry
EnqueuePriority(job);
if (result.ErrorType == PrintErrorType.ConversionError)
{
_logger.LogWarning("Job failed due to conversion error, not re-queuing");
}
else
{
// Re-queue with retry logic
job.RetryCount++;
_logger.LogWarning("Job failed, retrying ({RetryCount}/3)", job.RetryCount);
await Task.Delay(5000, cancellationToken); // Wait before retry
EnqueuePriority(job);
}
}
else
{