sidekiq-expiring-jobs 0.1.0 → 0.1.1

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: bb92ddcc1f401edb1b9f9462e599c9800ec8ea9550bc7568f16aab9bbf88ae88
4
- data.tar.gz: 9f2e2483ec683668a512f7580d93de0dac245ee7a1179c81b36e1da21d711532
3
+ metadata.gz: be92a3668591fa3a9987bea868fd0d98c2fb99d9790ccac8965fda9592f2284d
4
+ data.tar.gz: d6e5f93b30897691be59f24e3e6ec3d8ae8f6d6f4005be03b803c1c1778ac8c2
5
5
  SHA512:
6
- metadata.gz: a01c577b380b0f4a4d5cb02660bcca4d82cb33995c7f6042b99c9a28a9aa5185e15f2d6a5408e837843b37c0df9fd304efa52c870e2aa793811ff53597af6367
7
- data.tar.gz: c30d348d3d9bba82c26bf482e58572e05f06fb6a578a1a902d3b31d21ecbf82e383255f510718c6f6331b46c49abf727e2f511660e09124f1d3340f28f745b9c
6
+ metadata.gz: a03219dbd7c6d5fe26da5725bd8eff1fd520f9deb3fbb99d876192de5fa7d4d5dce3dcf5ac464a246e79843614b1c25e209c4f6898bffba36b098930cf3fb58c
7
+ data.tar.gz: 1724f454fc16a0514cbd3a6f1fc4209db076ad894b8c7c2c824089132bb555097f57b600f8ecf3cb6b0aeb869b0ae8f87b5ca4fd589fd5037e4bac8f28db0650
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  ## master (unreleased)
2
2
 
3
+ ## 0.1.1 (2024-01-14)
4
+
5
+ - Raise when `:expires_in` is an absolute time
6
+
3
7
  ## 0.1.0 (2023-04-12)
4
8
 
5
9
  - First release
data/README.md CHANGED
@@ -72,8 +72,6 @@ SidekiqExpiringJobs.expiration_callback = ->(job) {}
72
72
 
73
73
  ## Development
74
74
 
75
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
76
-
77
75
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
78
76
 
79
77
  ## Contributing
@@ -5,8 +5,11 @@ module SidekiqExpiringJobs
5
5
  class Client
6
6
  def call(_worker_class, job, _queue, _redis_pool)
7
7
  if (expires_in = job.delete("expires_in"))
8
+ expires_in = expires_in.to_f
9
+ raise ArgumentError, ":expires_in must be a relative time, not absolute time" if expires_in > 1_000_000_000
10
+
8
11
  at = job["at"] || job["created_at"]
9
- job["expires_at"] = at + expires_in.to_f
12
+ job["expires_at"] = at + expires_in
10
13
  end
11
14
  yield
12
15
  end
@@ -14,13 +17,9 @@ module SidekiqExpiringJobs
14
17
 
15
18
  class Server
16
19
  def call(_worker, job, _queue)
17
- if (expires_at = job["expires_at"])
18
- if expires_at >= Time.now.to_f
19
- yield
20
- else
21
- Sidekiq.logger.info("[SidekiqExpiringJobs] Expired #{job['class']} job (jid=#{job['jid']}) is skipped")
22
- SidekiqExpiringJobs.expiration_callback&.call(job)
23
- end
20
+ if job["expires_at"] && job["expires_at"] < Time.now.to_f
21
+ Sidekiq.logger.info("[SidekiqExpiringJobs] Expired #{job['class']} job (jid=#{job['jid']}) is skipped")
22
+ SidekiqExpiringJobs.expiration_callback&.call(job)
24
23
  else
25
24
  yield
26
25
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module SidekiqExpiringJobs
4
- VERSION = "0.1.0"
4
+ VERSION = "0.1.1"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sidekiq-expiring-jobs
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - fatkodima
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-04-12 00:00:00.000000000 Z
11
+ date: 2024-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sidekiq
@@ -63,7 +63,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
63
63
  - !ruby/object:Gem::Version
64
64
  version: '0'
65
65
  requirements: []
66
- rubygems_version: 3.4.7
66
+ rubygems_version: 3.5.4
67
67
  signing_key:
68
68
  specification_version: 4
69
69
  summary: Expiring jobs support for Sidekiq.