🐛 Fixes some issues in drive service
This commit is contained in:
@@ -41,7 +41,7 @@ public class BroadcastEventHandler(
|
|||||||
|
|
||||||
await js.EnsureStreamCreated("file_events", [FileUploadedEvent.Type]);
|
await js.EnsureStreamCreated("file_events", [FileUploadedEvent.Type]);
|
||||||
var fileUploadedConsumer = await js.CreateOrUpdateConsumerAsync("file_events",
|
var fileUploadedConsumer = await js.CreateOrUpdateConsumerAsync("file_events",
|
||||||
new ConsumerConfig("drive_file_uploaded_handler"), cancellationToken: stoppingToken);
|
new ConsumerConfig("drive_file_uploaded_handler") { MaxDeliver = 3 }, cancellationToken: stoppingToken);
|
||||||
|
|
||||||
var accountDeletedTask = HandleAccountDeleted(accountEventConsumer, stoppingToken);
|
var accountDeletedTask = HandleAccountDeleted(accountEventConsumer, stoppingToken);
|
||||||
var fileUploadedTask = HandleFileUploaded(fileUploadedConsumer, stoppingToken);
|
var fileUploadedTask = HandleFileUploaded(fileUploadedConsumer, stoppingToken);
|
||||||
@@ -75,8 +75,8 @@ public class BroadcastEventHandler(
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
logger.LogError(ex, "Error processing FileUploadedEvent for file {FileId}", payload?.FileId);
|
logger.LogError(ex, "Error processing FileUploadedEvent for file {FileId}", payload.FileId);
|
||||||
await msg.NakAsync(cancellationToken: stoppingToken);
|
await msg.NakAsync(cancellationToken: stoppingToken, delay: TimeSpan.FromSeconds(60));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -70,13 +70,11 @@ public class FileController(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return StatusCode(StatusCodes.Status503ServiceUnavailable, "File is being processed. Please try again later.");
|
return StatusCode(StatusCodes.Status400BadRequest, "File is being processed. Please try again later.");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!file.PoolId.HasValue)
|
if (!file.PoolId.HasValue)
|
||||||
{
|
|
||||||
return StatusCode(StatusCodes.Status500InternalServerError, "File is in an inconsistent state: uploaded but no pool ID.");
|
return StatusCode(StatusCodes.Status500InternalServerError, "File is in an inconsistent state: uploaded but no pool ID.");
|
||||||
}
|
|
||||||
|
|
||||||
var pool = await fs.GetPoolAsync(file.PoolId.Value);
|
var pool = await fs.GetPoolAsync(file.PoolId.Value);
|
||||||
if (pool is null)
|
if (pool is null)
|
||||||
|
Reference in New Issue
Block a user