mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-17 23:44:39 -05:00
Improved awaitCompletion interface
refs https://github.com/TryGhost/Toolbox/issues/358 - The method is a bit of a dangerous to use in cases when the job takes a long time to execute. - Returning a boolean value did not make sense and provided no helpful information. Having a job model (or not having one) gives the context in which the "completion" happened.
This commit is contained in:
parent
8f95759b68
commit
c88dcf749b
1 changed files with 4 additions and 3 deletions
|
@ -246,9 +246,10 @@ class JobManager {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Awaits completion of the offloaded job.
|
||||
* CAUTION: it might take a long time to resolve!
|
||||
* @param {String} name one-off job name
|
||||
* @returns
|
||||
* @returns resolves with a Job model at current state
|
||||
*/
|
||||
async awaitCompletion(name) {
|
||||
const persistedJob = await this._jobsRepository.read({
|
||||
|
@ -262,7 +263,7 @@ class JobManager {
|
|||
return this.awaitCompletion(name);
|
||||
}
|
||||
|
||||
return !!persistedJob;
|
||||
return persistedJob;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue