Skip to content

Commit

Permalink
Release 1.3.0 (#33)
Browse files Browse the repository at this point in the history
  • Loading branch information
lucas34 authored Dec 15, 2017
1 parent bab6ab9 commit e61ae5c
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
30 changes: 22 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,26 +71,40 @@ class SendTweetJob: Job {
// Type to know which Job to return in job creator
static let type = "SendTweetJob"
// Param
private let tweetMessage: String
private let tweet: [String: Any]

required init(message: String) {
required init(params: [String: Any]) {
// Receive params from JobBuilder.with()
self.tweetMessage = message
self.tweet = params
}

func onRun(callback: JobResult) throws {
// Run your job here
callback.onDone(error: nil)
do {
try Api().sendTweet(data: tweet)
// Consider the call synchronous in this case
callback.done(.success)
} catch let error {
callback.done(.fail(error))
}
}

func onRetry(error: Error) -> RetryConstraint {
// Check if error is non fatal
return error is ApiError ? RetryConstraint.cancel : RetryConstraint.retry
}

func onRemove(error: Error?) {
func onRemove(result: JobCompletion) {
// This job will never run anymore
// Success if error is nil. fail otherwise
switch result {
case .success:
// Job success
break

case .fail(let error):
// Job fail
break

}
}
}
```
Expand All @@ -106,7 +120,7 @@ Schedule a job with type, parameters and constraints.
```swift
JobBuilder(type: SendTweetJob.type)
// params of my job
.with(params: "Hello TweetWorld")
.with(params: ["content": "Hellow world"])
// Add to queue manager
.schedule(manager: manager)
```
Expand Down
2 changes: 1 addition & 1 deletion SwiftQueue.podspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Pod::Spec.new do |s|
s.name = "SwiftQueue"
s.version = "1.2.3"
s.version = "1.3.0"
s.summary = "SwiftQueue"
s.description = "Job Scheduler for IOS with Concurrent run, failure/retry, persistence, repeat, delay and more"
s.homepage = "https://github.com/lucas34/SwiftQueue"
Expand Down

0 comments on commit e61ae5c

Please sign in to comment.