refactoring
This commit is contained in:
@@ -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
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user