0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

post-scheduling: delete job but time is null (#7035)

no issue

This is a fix for the default-scheduler.
When a post never had a published_at value, the oldTime for removing the job would be null. And in this case we would try to delete a job with an invalidate date.
This commit is contained in:
Katharina Irrgang 2016-06-28 20:14:29 +02:00 committed by Hannah Wolfe
parent e91e9eadac
commit ded60ba6e8
2 changed files with 9 additions and 0 deletions

View file

@ -111,6 +111,10 @@ SchedulingDefault.prototype._addJob = function (object) {
};
SchedulingDefault.prototype._deleteJob = function (object) {
if (!object.time) {
return;
}
var deleteKey = object.url + '_' + moment(object.time).valueOf();
if (!this.deletedJobs[deleteKey]) {

View file

@ -151,6 +151,11 @@ describe('Scheduling Default Adapter', function () {
})();
});
it('delete job (unschedule): time is null', function () {
scope.adapter._deleteJob({time: null, url: '/test'});
Object.keys(scope.adapter.deletedJobs).length.should.eql(0);
});
it('pingUrl (PUT)', function (done) {
var app = express(),
server = http.createServer(app),