skiplock 1.0.15 → 1.0.16

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5c965cac0fea118b7a8295bd82999bd33cd2807829dee639b6b782279a27697d
4
- data.tar.gz: f5357c225546ef4fcec74a10b3180d07950c7f7f3308a39b2fe19c5668677a0f
3
+ metadata.gz: 7e9881d695e3f1a6241e3d86ca7844dff77ea3ba2b7431d70546a685dd1829a3
4
+ data.tar.gz: e9e2957e874d1a878f9302d4d08244830cf6abb7e9d9c6dc0970a2347344c0b7
5
5
  SHA512:
6
- metadata.gz: d42f8d156e11c25d117a246f30cee23e7c487ecfa80e74e0a10866013f2a6145afd42bb55e3f057ff1687f686ee4e030f851d88fd3c2d3a99b33df745c4617f0
7
- data.tar.gz: 981e7adad4bae9281e40bda3e049f68b32458078b98f192f5a9721ba31b40d82347c19a4da1876b210826a066f49f3ff0f2b8c966e9708b2d5b7d7bb890ff8b4
6
+ metadata.gz: 7d5045bc4dcee7ebab3838f7970a0ed681cda2756736491df734a60eb04d0b4a2a4525073e52e59df43a6ef2cd1f11ade191002de1be53ad01b0169f8b21687d
7
+ data.tar.gz: 75b542459110cbc57ac2ea1dd19a9f3431f1c9d744871c64e0543cdd61a76d87ab3e5c946bef1cab43d2401b2970f17d3d7c35019ed8647a3d96a98f8f5e6a2e
data/README.md CHANGED
@@ -53,7 +53,7 @@ The library is quite small compared to other PostgreSQL job queues (eg. *delay_j
53
53
  min_threads: 1
54
54
  max_threads: 5
55
55
  max_retries: 20
56
- logfile: log/skiplock.log
56
+ logfile: skiplock.log
57
57
  loglevel: info
58
58
  notification: custom
59
59
  extensions: false
@@ -67,7 +67,7 @@ The library is quite small compared to other PostgreSQL job queues (eg. *delay_j
67
67
  - **min_threads** (*integer*): sets minimum number of threads staying idle
68
68
  - **max_threads** (*integer*): sets the maximum number of threads allowed to run jobs
69
69
  - **max_retries** (*integer*): sets the maximum attempt a job will be retrying before it is marked expired. See `Retry system` for more details
70
- - **logfile** (*string*): path filename for skiplock logs; empty logfile will disable logging
70
+ - **logfile** (*string*): filename for skiplock logs; empty logfile will disable logging
71
71
  - **loglevel** (*string*): sets logging level (`debug, info, warn, error, fatal, unknown`)
72
72
  - **notification** (*string*): sets the library to be used for notifying errors and exceptions (`auto, airbrake, bugsnag, exception_notification, custom`); using `auto` will detect library if available. See `Notification system` for more details
73
73
  - **extensions** (*boolean*): enable or disable the class method extension. See `ClassMethod extension` for more details
@@ -84,7 +84,7 @@ The library is quite small compared to other PostgreSQL job queues (eg. *delay_j
84
84
  $ bundle exec skiplock -h
85
85
  Usage: skiplock [options]
86
86
  -e, --environment STRING Rails environment
87
- -l, --logfile STRING Full path to logfile
87
+ -l, --logfile STRING Log filename
88
88
  -s, --graceful-shutdown NUM Number of seconds to wait for graceful shutdown
89
89
  -r, --max-retries NUM Number of maxixum retries
90
90
  -t, --max-threads NUM Number of maximum threads
@@ -155,9 +155,9 @@ Outside the Rails application:
155
155
  # ...
156
156
  end
157
157
  ```
158
- If the retry attempt limit configured in ActiveJob has been reached, then the control will be passed back to `skiplock` to be marked as an expired job.
158
+ If the retry attempt limit configured in ActiveJob has been reached, then the control will be passed back to `Skiplock` to be marked as an expired job.
159
159
 
160
- If the `retry_on` block is not defined, then the built-in retry system of `skiplock` will kick in automatically. The retrying schedule is using an exponential formula (5 + 2**attempt). The `skiplock` configuration `max_retries` determines the the limit of attempts before the failing job is marked as expired. The maximum retry limit can be set as high as 20; this allows up to 12 days of retrying before the job is marked as expired.
160
+ If the `retry_on` block is not defined, then the built-in retry system of `Skiplock` will kick in automatically. The retrying schedule is using an exponential formula (5 + 2**attempt). The `Skiplock` configuration `max_retries` determines the the limit of attempts before the failing job is marked as expired. The maximum retry limit can be set as high as 20; this allows up to 12 days of retrying before the job is marked as expired.
161
161
 
162
162
  ## Notification system
163
163
  `Skiplock` can use existing exception notification library to notify errors and exceptions. It supports `airbrake`, `bugsnag`, and `exception_notification`. Custom notification can also be called whenever an exception occurs; it can be configured in an initializer like below:
@@ -188,7 +188,11 @@ If the `retry_on` block is not defined, then the built-in retry system of `skipl
188
188
  ```
189
189
 
190
190
  ## Fault tolerant
191
- `Skiplock` ensures that jobs will be executed sucessfully only once even if database connection is lost during or after the job was dispatched. Successful jobs are marked as completed or removed (with `purge_completion` turned on), and failed or interrupted jobs are marked for retry; however, when the database connection is dropped for any reasons and the commit is lost, `Skiplock` will then save the commit data to local disk (as `tmp/skiplock/<job_id>`) and synchronize with the database when the connection resumes. This also protects in-progress jobs that were terminated abruptly during a graceful shutdown with timeout; they will be queued for retry.
191
+ `Skiplock` ensures that jobs will be executed sucessfully only once even if database connection is lost during or after the job was dispatched. Successful jobs are marked as completed or removed (with `purge_completion` turned on), and failed or interrupted jobs are marked for retry.
192
+
193
+ However, when the database connection is dropped for any reasons and the commit is lost, `Skiplock` will then save the commit data to local disk (as `tmp/skiplock/<job_id>`) and synchronize with the database when the connection resumes.
194
+
195
+ This also protects in-progress jobs that were terminated abruptly during a graceful shutdown with timeout; they will be queued for retry.
192
196
 
193
197
  ## Scalability
194
198
  `Skiplock` can scale both vertically and horizontally. To scale vertically, simply increase the number of `Skiplock` workers per host. To scale horizontally, simply deploy `Skiplock` to multiple hosts sharing the same PostgreSQL database.
data/bin/skiplock CHANGED
@@ -1,5 +1,6 @@
1
1
  #!/usr/bin/env ruby
2
2
  require 'optparse'
3
+ require_relative '../lib/skiplock/version'
3
4
  options = {}
4
5
  begin
5
6
  op = OptionParser.new do |opts|
@@ -10,6 +11,10 @@ begin
10
11
  opts.on('-r', '--max-retries NUM', Integer, 'Number of maxixum retries')
11
12
  opts.on('-t', '--max-threads NUM', Integer, 'Number of maximum threads')
12
13
  opts.on('-T', '--min-threads NUM', Integer, 'Number of minimum threads')
14
+ opts.on('-v', '--version', 'Show version information') do
15
+ puts "Skiplock Version #{Skiplock::VERSION}"
16
+ exit
17
+ end
13
18
  opts.on('-w', '--workers NUM', Integer, 'Number of workers')
14
19
  opts.on_tail('-h', '--help', 'Show this message') do
15
20
  exit
data/lib/skiplock/job.rb CHANGED
@@ -73,6 +73,7 @@ module Skiplock
73
73
  self.data['last_cron_at'] = Time.now.utc.to_s
74
74
  next_cron_at = Cron.next_schedule_at(self.cron)
75
75
  if next_cron_at
76
+ self.finished_at = nil
76
77
  self.executions = nil
77
78
  self.exception_executions = nil
78
79
  self.scheduled_at = Time.at(next_cron_at)
@@ -1,4 +1,4 @@
1
1
  module Skiplock
2
- VERSION = Version = '1.0.15'
2
+ VERSION = Version = '1.0.16'
3
3
  end
4
4
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: skiplock
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.15
4
+ version: 1.0.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tin Vo
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-09-09 00:00:00.000000000 Z
11
+ date: 2021-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activejob