Stable run
continuous-integration/drone/pr Build is passing

This commit is contained in:
Khwezi Mngoma
2026-06-02 00:29:02 +02:00
parent f299e8952a
commit 3d506cffd1
5 changed files with 63 additions and 42 deletions
@@ -8,6 +8,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="LiteCharms.Features.MidrandBooks" Version="1.64.0" />
<PackageReference Include="Microsoft.Extensions.Hosting" Version="10.0.8" />
<PackageReference Include="Mediator.SourceGenerator" Version="3.0.2">
<PrivateAssets>all</PrivateAssets>
@@ -17,7 +18,7 @@
<!-- Lite Charms Libraries -->
<ItemGroup>
<PackageReference Include="LiteCharms.Features" Version="1.34.0" />
<PackageReference Include="LiteCharms.Features" Version="1.64.0" />
</ItemGroup>
<!-- Shared Global Usings -->
+8 -12
View File
@@ -1,15 +1,12 @@
using LiteCharms.Features.Extensions;
using LiteCharms.Features.Mediator;
using LiteCharms.Features.MidrandBooks.Extensions;
using LiteCharmsScheduler.Workers;
using static LiteCharms.Features.Email.Extensions.Constants;
using static LiteCharms.Features.Extensions.Quartz;
var builder = Host.CreateApplicationBuilder(args);
builder.Services.AddMediator(options => options.Assemblies = new List<AssemblyReference>
{
typeof(Program).Assembly,
typeof(LiteCharms.Features.Shop.Notifications.Events.ProcessEmailNotificationsEvent).Assembly
}.AsReadOnly());
builder.Services.AddMediator();
builder.Services.AddScoped(typeof(IPipelineBehavior<,>), typeof(TelemetryPipelineBehavior<,>));
builder.Services.AddScoped(typeof(IPipelineBehavior<,>), typeof(LoggingPipelineBehavior<,>));
@@ -17,19 +14,18 @@ builder.Services.AddScoped(typeof(IPipelineBehavior<,>), typeof(LoggingPipelineB
builder.Services.AddEmailServices(builder.Configuration);
builder.Services.AddEmailServiceBus();
builder.Services.AddSalesServiceBus();
builder.Services.AddGeneralServiceBus();
builder.Services.AddQuartzScheduler(ShopSchedulerName, builder.Configuration);
builder.Services.AddShopServices();
builder.Services.AddShopDatabase(builder.Configuration);
builder.Services.AddHashServices(builder.Configuration);
builder.Services.AddMidrandShopDatabase(builder.Configuration);
builder.Services.AddQuartzScheduler(MidrandShopSchedulerName, builder.Configuration);
builder.Services.AddHostedService<JobWorker>();
var host = builder.Build();
var schedulerFactory = host.Services.GetRequiredService<ISchedulerFactory>();
var scheduler = await schedulerFactory.GetScheduler(ShopSchedulerName);
var scheduler = await schedulerFactory.GetScheduler(MidrandShopSchedulerName);
if (!scheduler!.IsStarted)
await scheduler.Start();
+2 -13
View File
@@ -1,21 +1,10 @@
using LiteCharms.Features.Quartz.Abstractions;
using LiteCharms.Features.Shop.Notifications.Events;
namespace LiteCharmsScheduler.Workers
{
public class JobWorker(IJobOrchestrator jobOrchestrator, ILogger<JobWorker> logger, IConfiguration configuration) : BackgroundService
{
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
string? emailProcessorCron = !string.IsNullOrWhiteSpace(configuration.GetSection("EmailProcessorCron").Value)
? configuration.GetSection("EmailProcessorCron").Value
: "0 */4 * * * ?";
var emailProcessorJob = ProcessEmailNotificationsEvent.Create();
await jobOrchestrator.ScheduleAsync(emailProcessorJob, emailProcessorCron!, stoppingToken);
logger.LogInformation("Startup jobs scheduled");
}
protected override async Task ExecuteAsync(CancellationToken stoppingToken) =>
logger.LogInformation("Midrand Books jobs initialized");
}
}
+10 -9
View File
@@ -1,18 +1,19 @@
{
"Email": {
"Credentials": {
"Username": "shop@litecharms.co.za"
},
"Port": 465,
"Host": "mail.litecharms.co.za",
"UseSsl": true
"HasherSettings": {
"MinHashLength": 11
},
"BookshopS3Settings": {
"ServiceUrl": "http://192.168.1.177:30900",
"Region": "garage",
"BucketName": "bookshop",
"CdnBaseUrl": "https://bookshop.cdn.khongisa.co.za"
},
"EmailProcessorCron": "0 */5 * * * ?",
"Monitoring": {
"ApiKey": "",
"Address": "http://aspire-dashboard-service.aspire.svc.cluster.local:18889",
"ServiceName": "LiteCharms.LeadGenerator"
"ServiceName": "MidrandBooks.DEV"
},
"EmailProcessorCron": "0 */5 * * * ?",
"Logging": {
"LogLevel": {
"Default": "Information",