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 +4 -4
- data/CHANGELOG.md +4 -0
- data/README.md +0 -2
- data/lib/sidekiq_expiring_jobs/middleware.rb +7 -8
- data/lib/sidekiq_expiring_jobs/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be92a3668591fa3a9987bea868fd0d98c2fb99d9790ccac8965fda9592f2284d
|
4
|
+
data.tar.gz: d6e5f93b30897691be59f24e3e6ec3d8ae8f6d6f4005be03b803c1c1778ac8c2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a03219dbd7c6d5fe26da5725bd8eff1fd520f9deb3fbb99d876192de5fa7d4d5dce3dcf5ac464a246e79843614b1c25e209c4f6898bffba36b098930cf3fb58c
|
7
|
+
data.tar.gz: 1724f454fc16a0514cbd3a6f1fc4209db076ad894b8c7c2c824089132bb555097f57b600f8ecf3cb6b0aeb869b0ae8f87b5ca4fd589fd5037e4bac8f28db0650
|
data/CHANGELOG.md
CHANGED
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
|
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
|
18
|
-
|
19
|
-
|
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
|
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.
|
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:
|
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
|
66
|
+
rubygems_version: 3.5.4
|
67
67
|
signing_key:
|
68
68
|
specification_version: 4
|
69
69
|
summary: Expiring jobs support for Sidekiq.
|