mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Use job priorities
This commit is contained in:
parent
4d2f887517
commit
4e4cd49a89
@ -71,9 +71,9 @@ namespace Wabbajack.BuildServer
|
||||
while (true)
|
||||
{
|
||||
await KillOrphanedJobs();
|
||||
await ScheduledJob<GetNexusUpdatesJob>(TimeSpan.FromHours(2));
|
||||
await ScheduledJob<UpdateModLists>(TimeSpan.FromMinutes(30));
|
||||
await ScheduledJob<EnqueueAllArchives>(TimeSpan.FromHours(2));
|
||||
await ScheduledJob<GetNexusUpdatesJob>(TimeSpan.FromHours(2), Job.JobPriority.High);
|
||||
await ScheduledJob<UpdateModLists>(TimeSpan.FromMinutes(30), Job.JobPriority.High);
|
||||
await ScheduledJob<EnqueueAllArchives>(TimeSpan.FromHours(2), Job.JobPriority.Low);
|
||||
await Task.Delay(10000);
|
||||
}
|
||||
}
|
||||
@ -100,7 +100,7 @@ namespace Wabbajack.BuildServer
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ScheduledJob<T>(TimeSpan span) where T : AJobPayload, new()
|
||||
private async Task ScheduledJob<T>(TimeSpan span, Job.JobPriority priority) where T : AJobPayload, new()
|
||||
{
|
||||
try
|
||||
{
|
||||
@ -117,6 +117,7 @@ namespace Wabbajack.BuildServer
|
||||
}
|
||||
await Db.Jobs.InsertOneAsync(new Job
|
||||
{
|
||||
Priority = priority,
|
||||
Payload = new T()
|
||||
});
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ namespace Wabbajack.BuildServer.Models.Jobs
|
||||
{
|
||||
try
|
||||
{
|
||||
await ValidateList(db, list, queue);
|
||||
await EnqueueFromList(db, list, queue);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
@ -38,7 +38,7 @@ namespace Wabbajack.BuildServer.Models.Jobs
|
||||
return JobResult.Success();
|
||||
}
|
||||
|
||||
private static async Task ValidateList(DBContext db, ModlistMetadata list, WorkQueue queue)
|
||||
private static async Task EnqueueFromList(DBContext db, ModlistMetadata list, WorkQueue queue)
|
||||
{
|
||||
var existing = await db.ModListStatus.FindOneAsync(l => l.Id == list.Links.MachineURL);
|
||||
|
||||
@ -77,7 +77,7 @@ namespace Wabbajack.BuildServer.Models.Jobs
|
||||
|
||||
Utils.Log($"Found {missing.Count} missing archives, enqueing indexing jobs");
|
||||
|
||||
var jobs = missing.Select(a => new Job {Payload = new IndexJob {Archive = a}});
|
||||
var jobs = missing.Select(a => new Job {Payload = new IndexJob {Archive = a}, Priority = Job.JobPriority.Low});
|
||||
|
||||
Utils.Log($"Writing jobs to the DB");
|
||||
await db.Jobs.InsertManyAsync(jobs, new InsertManyOptions {IsOrdered = false});
|
||||
|
Loading…
Reference in New Issue
Block a user