🐛 Fixed email sending job execution

refs https://github.com/TryGhost/Toolbox/issues/359

- Sending newsletters got broken because underlying "inline job" execution had a bug.
- The real problem was in the job manager trying to verify inline unnamed job status in the database without having a name.
This commit is contained in:
Naz 2022-07-27 15:12:52 +01:00
parent b0144a7f8f
commit b7853323ae
2 changed files with 4 additions and 2 deletions

View File

@ -81,7 +81,7 @@ class JobManager {
}
async _jobMessageHandler({name, message}) {
if (this._jobsRepository) {
if (this._jobsRepository && name) {
if (message === 'started') {
const job = await this._jobsRepository.read(name);

View File

@ -33,7 +33,9 @@ describe('Job Manager', function () {
describe('Inline jobs', function () {
it('adds a job to a queue', async function () {
const spy = sinon.spy();
const jobManager = new JobManager({});
const jobManager = new JobManager({
JobModel: sinon.stub().resolves()
});
jobManager.addJob({
job: spy,