- Added support for new "callbackStrict" option to
processJobs()
. Whentrue
(defaultfalse
)processJobs()
will throw an error if a worker function calls its callback more than once. Previously it only wrote a message to stderr in all cases. That functionality is preserved with this change. - Added
job.repeatRetries
as an optional (for backward compatibility) attribute of the job document model. This attribute is used (when present) for the number of retries to attempt for the new instance of a repeating job. When missing (such as will be the case for jobs created by older versions of meteor-job) the old method of usingjob.retries + job.retried
is used. - Fix an error caused by a check on
retries
when a waiting/ready job is cancelled, restarted and then refreshed. This condition also occurs whenjob.restart()
is called with optionretries
greater than the current value ofjob.retried
(which is the default case after a cancel of a non-running job.) Thanks @huttarichard. - In coordination with the above change, the
retries
option ofjob.restart()
will now accept a value of zero. - Fixed race condition in
processJobs()
that could causeJob.getWork()
to run after the queue is paused or stopped, leading to a zombie job on the server. - Documentation improvements
- Updated package dependencies
- Fixed error affecting all of the *Jobs functions which caused them to only process the first 256 jobs in the provided list of _id values.
- Updated package dependencies
- Fix broken links in README
- Updated package dependencies
- Documentation improvements (typos)
- Added
delayDeps
option tojob.done()
to allow dependent jobs to be delayed after the completion of an antecedent job. Thanks to @a4xrbj1 for suggesting. - Fixed bug in
Job.jobStatuses
, Thanks @niceilm - Invoking server-only or client-only methods in the wrong environment now generates a warning method. Thanks @aardvarkk.
- Additional indexes added to make built-in queries more efficient for large collections. Thanks @mitar.
- Internal improvements in event handlers. Thanks @mitar.
- Documentation improvements, Thanks @rhyslbw, @mitar and @jdcc !
- Updated job subproject to v1.3.2
- Fix issue when very long
promote()
cycles are used, causing waiting jobs that are ready to run at a server restart to be delayed one full promotion cycle. Thanks to @KrishnaPG for reporting this.
- Fixed bug in the
jc.getWork()
workTimeout
functionality that could cause a running job to immediately auto-expire on the server if it was previously run with aworkTimeout
value, and was then subsequently run without aworkTimeout
value after the original job was rerun, restarted, retried or repeated. - Updated job subproject to v1.3.1
- Updated README to include links to job-collection playground app and node.js worker repos
- Fixed
log()
on jobs withoutrunId
by loosening check injobLog()
. Thanks @sprohaska for the PR!
- Added ability for workers to specify a timeout for running jobs, so that if they crash or lose connectivity the job can automatically fail and be restarted.
getWork()
andprocessJobs()
now each have a new optionworkTimeout
that sets the number of milliseconds until a job can be automatically failed on the server. If not specified, the default behavior is as before (running jobs with no active worker need to be handled by the developer.) Thanks to @aldeed for the idea of making this a worker setting. - Added
repeatId
option tojob.done()
which whentrue
will cause the successful return value of a repeating job to be the_id
of the newly scheduled job. Thanks to @tcastelli for this idea. - Added
jc.events
, which is a node.js Event Emitter allowing server code to register callbacks to log or generate statistics based upon all job-collection DDP methods. There are two main events currently implemented:'call'
for successful DDP method calls, and'error'
for any errors thrown in such calls. There are also events defined for each of the 18 DDP methods (e.g.jobDone
orgetWork
). These events emit for every such call, whether successful for not. - Added new DDP method methods
job.ready()
andjc.readyJobs()
to provide a standard way to promote jobs from'waiting'
to'ready'
. - Throw an error when a buggy monkey patch has been applied to
Mongo.collection
(usually by some other package). See this discussion for details. - The built-in default server logging mechanism (through
setLogStream()
) has been refactored to be built on top of the new Event Emitter mechanism. It otherwise works exactly as before. - Providing a falsy value of option
pollInterval
when callingJob.processJobs()
will now disable polling in favor of usingq.trigger
exclusively. - Fixed bug where
q.trigger()
caused agetWork()
call, even when the queue is paused. - Fixed a bug in
job.rerun()
that caused it to fail if called with a later.js object for the wait parameter. - Documentation updates and other improvements, with thanks to @skosch for a documentation PR.
- Fixed issue when using multiple job-collections with different DDP connections in use. Thanks to @mart-jansink for reporting this issue.
- Documentation improvements. Thanks @kahmali!
- Added explicit package version to
onTest()
call to work around a Meteor issue when runningmeteor test-packages
within an app. - Fixes issue when
getJob()
called withgetLog
orgetFailures
options. - Fixes incorrect log level of
'warn'
for job cancellation (correct is'warning'
). - Thanks to @kingkevin for PR fixing the above two issues.
- Added a client polyfill for Function.bind() which is missing from phantomJS
- Fixed a bug that caused server-side calls to job collection using callbacks to throw rather than properly propagating errors via the provided callback.
- Updated meteor-job package to 1.1.1, fixing a bug that could cause JobQueues to get more work than configured when using
q.trigger()
or very short pollIntervals.
- Support for using later.js schedules to configure repeating jobs.
- Removed unnecessary server-side console output.
jc.startJobs
andjc.stopJobs
have been renamed tojc.startJobServer
andjc.shutdownJobServer
respectively. The old versions will now generate deprecation warnings.jc.makeJob()
andjc.createJob()
have been deprecated in favor of just callingnew Job(...)
- Fixed an issue similar to #51 on the client-side.
- Fixed issue #55. All standard Mongo.Collection options should now work with JobCollections as well.
- Updated versions of package dependencies
- Fixed issue #41. The potential race condition in getWork is handled internally
- Fixed issue #57. Default MongoDB indexes enabled by default
- Fixed issue #55, all valid Mongo.Collection options are now supported. However, transformed documents may fail to validate unless "scrubbed". More work needs to go into documenting this.
- Fixed #28. Eliminated all "success" console logs.
- job objects now have
job.doc
readable attribute jc.jobDocPattern
can now be used to validate Job documents.j.refresh()
is now chainable- Added
jq.trigger()
method to provide a mechanism to triggergetWork
using an alternative method topollInterval
job.log()
can now accept adata
option, which must be an object.log.data
field is now permitted in the Job document model.- When
job.fail(err)
is used, the error object stored in thefailures
array will have therunId
as an added field. connection
option tonew JobCollection()
on client or server will now direct the local Job Collection to connect to an alternate remote server's Job Collection rather than using the default connection (client) or hosting a collection locally (server).
- Fixed issue #51, which caused errors on the server-side when multiple job-collection instances were used.
Note! There are some breaking changes here! Specifically, the job.fail()
change below. See the docs for specifics.
- Added support for Meteor 0.9.x style packages, including name change to accomodate
job.fail()
now takes an object forerror
. Previously this was a string message.- Refactored JobCollection classes
- Jobs that are ready-to-run go straight from
waiting
toready
without waiting for a promote cycle to come around. - Don't check for
after
andretries
ingetWork()
- Allow the server to add data to
job._private
that won't be shared with a client viagetWork()
andgetJob()
. Be sure not to publish cursors that returnjob._private
! - Added support for
@scrub
hook function to sanitize documents before validating them ingetWork()
andgetJob()
- Updated to use the latest version of the
meteor-job
npm package
- Added
until
option forjob.repeat()
,job.retry()
, job.restart() and job.rerun(). - Added
jc.foreverDate
to indicate a Date that will never come - Fixed bug where
jc.forever
was not available - Default Date for
job.after()
is now based on the server clock, not the clock of the machine creating the job. (thanks @daeq) - Added
created
field to job document model to keep track of when a job was first created on the server
- Added
idGeneration
andnoCollectionSuffix
options to JobCollection constructor. Thanks to @mitar for suggestions. - Removed unnecessary console log outputs
- Updated README to point to new sample app, and to clarify the use of
jc.promote()
in Meteor multi-instance deployments.
- Fixed bugs in client simulations of stopJobs and startJobs DDP methods
- Fixed bug due to removal of validNumGTEOne
- Fixed bug in jobProgress due to missing validNumGTZero
- Changed the default value of
job.save()
cancelRepeats
option to befalse
. - Fixed a case where the
echo
options tojob.log()
could be sent to the server, resulting in failure of the operation. - Documentation improvements courtesy of @dandv.
- Added
backoff
option tojob.retry()
. Implements resolves enhancement request #2
- Fixed bug introduced by "integer enforcement" change in v0.0.7. Integers may now be up to 53-bits (the Javascript maxInt). Fixes #3
- Fixed sort inversion of priority levels in
getWork()
. Fixes #4 - Thanks to @chhib for reporting the above two issues.
- Bumped meteor-job version to 0.0.9, fixing several bugs in Meteor.server and Meteor.client workers handling.
- Corrected validation of jobDocuments for non-negative integer attributes (integer enforcement was missing).
- jc.promote() formerly had a minimum valid polling rate of 1000ms, now any value > 0ms is valid
- Added a few more acceptance tests including client and server scheduling and running of a job.
- Documentation improvements
- Added initial testing harness
- Fixed issue with collection root name in DDP method naming.
- Changed evaluation of allow/deny rules so deny rules run first, just like in Meteor.
- Documentation improvements.
- Really fixed issue #1, thanks again to @chhib for reporting this.
- Test release debugging git submodule issues around issue #1
- Fixed issue #1, thanks to @chhib for reporting this.
- Documentation improvements
- Removed meteor-job subproject and added npm dependency on it instead
- Initial revision.