Skip to content

Commit

Permalink
Fix quartz scheduleId
Browse files Browse the repository at this point in the history
  • Loading branch information
leewrigh committed Nov 4, 2024
1 parent 062ed4e commit b3d3a32
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 9 deletions.
22 changes: 15 additions & 7 deletions backend/service.edt/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public Startup(IConfiguration configuration)

public static IConfiguration StaticConfig { get; private set; }


[Obsolete]
public void ConfigureServices(IServiceCollection services)
{
var config = this.InitializeConfiguration(services);
Expand Down Expand Up @@ -238,16 +238,27 @@ public void ConfigureServices(IServiceCollection services)
services.AddQuartz(q =>
{
Log.Information("Starting scheduler..");
q.SchedulerId = "Folio-Linkage-Scheduler";
q.SchedulerName = "DIAM Scheduler";
var schedulerId = $"DIAM-EDT-Scheduler-{Guid.NewGuid()}";
q.SchedulerId = schedulerId;
q.SchedulerName = "DIAM EDT Scheduler";
q.UsePersistentStore(store =>
{
q.UseDefaultThreadPool(tp =>
{
tp.MaxConcurrency = 3;
});
store.UseClustering(c =>
{
c.CheckinMisfireThreshold = TimeSpan.FromSeconds(15);
c.CheckinInterval = TimeSpan.FromSeconds(10);
});
// Use for PostgresSQL database
store.UsePostgres(pgOptions =>
{
pgOptions.UseDriverDelegate<PostgreSQLDelegate>();
pgOptions.ConnectionString = config.ConnectionStrings.EdtDataStore;
pgOptions.ConnectionString = $"{config.ConnectionStrings.EdtDataStore};MaxConnections=3";
pgOptions.TablePrefix = "quartz.qrtz_";
});
store.UseJsonSerializer();
Expand All @@ -265,9 +276,6 @@ public void ConfigureServices(IServiceCollection services)
.WithDescription("Court access scheduled event")
.WithCronSchedule(config.FolioLinkageBackgroundService.PollCron));
});


Expand Down
16 changes: 14 additions & 2 deletions backend/webapi/Startup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,24 @@ public void ConfigureServices(IServiceCollection services)

services.AddQuartz(q =>
{
Log.Information("Starting scheduler..");
q.SchedulerId = "Court-Access-Core";
var schedulerId = $"DIAM-Quartz-Scehduler-{Guid.NewGuid().ToString()}";
q.SchedulerId = schedulerId;
q.SchedulerName = "DIAM Scheduler";
q.UseDefaultThreadPool(tp =>
{
tp.MaxConcurrency = 3;
});
q.UsePersistentStore(store =>
{
store.UseClustering(c =>
{
c.CheckinMisfireThreshold = TimeSpan.FromSeconds(15);
c.CheckinInterval = TimeSpan.FromSeconds(10);
});
// Use for PostgresSQL database
store.UsePostgres(pgOptions =>
{
Expand All @@ -273,7 +285,7 @@ public void ConfigureServices(IServiceCollection services)
// Create a "key" for the job
var jobKey = new JobKey("Court access trigger");
q.AddJob<CourtAccessScheduledJob>(opts => opts.WithIdentity(jobKey));
q.AddJob<CourtAccessScheduledJob>(opts => { opts.WithIdentity(jobKey); });
Log.Information($"Scheduling CourtAccessScheduledJob with params [{config.CourtAccess.PollCron}]");
Expand Down

0 comments on commit b3d3a32

Please sign in to comment.