mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Can manually enqueue jobs
This commit is contained in:
parent
213df5bc0e
commit
af9f0dbf89
@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.AspNetCore.Mvc;
|
||||
using Microsoft.Extensions.Logging;
|
||||
@ -26,5 +27,15 @@ namespace Wabbajack.BuildServer.Controllers
|
||||
.OrderByDescending(j => j.Priority)
|
||||
.ToListAsync();
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[Route("enqueue_job/{JobName}")]
|
||||
public async Task<string> EnqueueJob(string JobName)
|
||||
{
|
||||
var jobtype = AJobPayload.NameToType[JobName];
|
||||
var job = new Job{Priority = Job.JobPriority.High, Payload = (AJobPayload)jobtype.GetConstructor(new Type[0]).Invoke(new object?[0])};
|
||||
await Db.Jobs.InsertOneAsync(job);
|
||||
return job.Id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user