Swiftpack.co - Package - vapor/jobs

Github

link
Stars: 96

Dependencies

Releases

Use Same EventLoop for Job Worker - 2020-02-07 02:27:31

Job workers will now use the same EventLoop as the scheduled task that runs them (fixes https://github.com/vapor/jobs-redis-driver/issues/11, #59).

Bail early if no scheduled jobs exist - 2020-01-24 02:41:57

If no scheduled jobs exist, fail early from the process to avoid running the worker unnecessarily.

Fix everySecond bug - 2020-01-24 02:31:49

This update fixes a bug that caused everySecond() not to fire when running scheduled jobs.

Support for In-Process workers - 2020-01-04 17:26:08

Jobs can now run as an in-process worker instead of a separate worker side-by-side with the main application:

try JobsCommand(application: app, scheduled: false).startJobs(on: .default)

Or:

try JobsCommand(application: app, scheduled: true).startScheduledJobs()

Jobs 1.0.0 Beta 3 - 2019-12-09 21:37:46

  • Updated to latest Vapor beta 2 release (#48)
import Jobs
import Vapor

let email = Email()
app.jobs.add(email)

try app.jobs.use(.redis(url: "redis://\(hostname):6379"))

app.get("send-email") { req in
    req.jobs.dispatch(Email.self, .init(to: "tanner@vapor.codes"))
        .map { HTTPStatus.ok }
}
  • Enabled test discovery on Linux. (#49)

Beta 2.1.0 - 2019-11-13 16:17:26

Adds a new .at() API on ScheduledJob for one-off jobs with a specific date

Beta 2.0.0 - 2019-11-09 17:07:09

Breaking Changes:

Dispatching jobs is now more type safe:

app.get("foo") { req in
    return req.jobs.dispatch(FooJob.self, .init(foo: "bar"))
        .map { "done" }
}

Beta 1.0.2 - 2019-11-09 13:26:44

New registration API (#43):

let app = Application(environment: env)
app.provider(JobsProvider())

app.jobs.driver(TestDriver())
app.jobs.add(FooJob())
app.jobs.add(BarJob())
app.jobs.add(QuxJob())

Beta 1.0.1 - 2019-11-01 12:38:21

Quick patch to fix a delayUntil bug (#42)

Beta 1 - 2019-10-25 12:11:01

  • Update to Vapor Beta 1
  • You can now access the jobs worker via req.jobs
  • The new configuration setup looks like this:
let app = Application(environment: env)
app.provider(JobsProvider())
app.register(JobsDriver.self) { app in
    return TestDriver(on: app.make())
}
app.register(extension: JobsConfiguration.self) { jobs, app in
    jobs.add(FooJob())
}
return app
  • Added a new queuedAt property to the JobStorage object
  • Added informational dispatch log

Scheduled Jobs - 2019-08-08 22:02:47

New:

  • Vapor Jobs now has scheduled jobs

Fix typo - 2019-06-23 21:43:05

Fix retrying bug - 2019-06-23 21:32:02

Fixes a bug that prevented retrying jobs

Fix retrying bug - 2019-06-23 21:25:56

Fixes a bug found by @saicu that prevented jobs from re-running upon error

Jobs 1.0.0 Alpha 2 - 2019-06-21 23:46:12

New:

  • New (internal) JobsWorker encapsulation for repeated tasks (#30)
  • QueueService has been renamed to JobsService (#30, #27)
  • QueueName has been renamed to JobsQueue (#30, #27)
  • Some configuration properties have been moved from JobsProvider to JobsConfiguration (#30, #26, #29)

Fixed:

  • New instances of JobsConfiguration are created for each EventLoop. (#30)

Jobs 1.0.0 Alpha 1.2 - 2019-06-21 17:10:15

New:

  • JobsProvider now registers all services required to use the package. (#25, #23, #24)

To use Jobs, the following code should now be sufficient:

services.provider(JobsProvider())

services.extend(JobsConfiguration.self) { configuration, container in
    // add jobs to configuration
}

Delay - 2019-06-13 15:31:31

Added a delayUntil property

Jobs 1.0.0 Alpha 1 - 2019-06-11 16:22:37

More information on Vapor 4 alpha releases:

https://medium.com/@codevapor/vapor-4-alpha-1-releases-begin-94a4bc79dd9a

API Docs:

https://api.vapor.codes

Fix completed function - 2019-03-12 21:48:33

Correctly calls the completed function after each job run.

Public property - 2019-02-12 19:39:06

Makes id public on JobStorage

Update `error` method - 2019-02-06 17:35:22

Fixed:

  1. Updates the error function to include a data parameter.

Protocol Changes - 2019-02-05 23:36:50

⚠️ This release includes breaking changes ⚠️

Changed:

  1. The Job protocol is no longer constrained to Codable.
  2. The Job protocol now has a Codable associatedtype
  3. Added a JobData protocol
  4. Renamed JobData -> JobStorage
  5. Updated the JobsPersistenceLayer to pass JobStorage objects rather than strings
  6. Removed Worker parameter requirement from Job protocol. EventLoops can be accessed via context.eventLoop

Upcoming:

  1. Reliable queue worker: vapor run jobs --reliable will run a single worker that will move stale jobs from the processing queue back to the upcoming queue.
  2. Scheduled jobs

Cleanup Console logs - 2019-01-25 02:00:49

- 2019-01-24 01:25:20

First beta release - 2018-12-11 02:41:40

This release includes everything that is detailed in the README.md. Not tested in production yet although it should be functional enough to hold up.