ruby-clock 0.8.0.rc3 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG.md +1 -7
- data/README.md +33 -2
- data/example-app/Gemfile.lock +1 -1
- data/example-app/README.md +1 -1
- data/lib/ruby-clock/version.rb +1 -1
- data/lib/ruby-clock.rb +1 -1
- metadata +4 -5
- data/Gemfile.lock +0 -33
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bb7709e5cb45330de5b30adb906cc15e847207894a2ad71b3afd706ea0235f09
|
4
|
+
data.tar.gz: 9ab66e406ada9646d83f28806c07018641953b7b56f8824b49e14b3bd2ad2b7c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d14858bb6c936e07e66527c9f670d68e236d56ccce407da9c5472334748a3b3f07012f82ff827fb314557b318a555a0e50ff9914b36330fe9cbd7c271da76532
|
7
|
+
data.tar.gz: '033369b93174cdba782d21fa150f63f521bf058d9ef6a654fbb54fd53e2b529f753350b5e086aa2b7e5df2cd0647cf9f932aceb6aaeabba892727dfb978ed1a8'
|
data/.gitignore
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,13 +1,7 @@
|
|
1
|
-
## 0.
|
1
|
+
## 1.0.0
|
2
2
|
|
3
3
|
* make terrapin and posix-spawn gems optional
|
4
|
-
|
5
|
-
## 0.8.0 RC2
|
6
|
-
|
7
4
|
* fix detection of Rails constant, for non-rails apps
|
8
|
-
|
9
|
-
## 0.8.0 RC1
|
10
|
-
|
11
5
|
* automatically wrap jobs with rails reloader
|
12
6
|
* ability to run rake tasks
|
13
7
|
* ability to run shell commands
|
data/README.md
CHANGED
@@ -12,8 +12,8 @@ ruby-clock does.
|
|
12
12
|
|
13
13
|
Jobs are all run in their own parallel threads within the same process.
|
14
14
|
|
15
|
-
The clock process will respond to signals INT (
|
16
|
-
TERM (signal sent by environments such as Heroku and other PaaS's when shutting down).
|
15
|
+
The clock process will respond to signals `INT` (<kbd>^c</kbd> at the command line) and
|
16
|
+
`TERM` (signal sent by environments such as Heroku and other PaaS's when shutting down).
|
17
17
|
In both cases, the clock will stop running jobs and give existing jobs 29 seconds
|
18
18
|
to stop before killing them.
|
19
19
|
You can change this number with `RUBY_CLOCK_SHUTDOWN_WAIT_SECONDS` in the environment.
|
@@ -75,7 +75,22 @@ To get smarter database connection management (such as in the case of a database
|
|
75
75
|
and maybe other benefits) and code reloading in dev (app code, not the code in Clockfile itself),
|
76
76
|
jobs are automatically wrapped in the
|
77
77
|
[rails app reloader](https://guides.rubyonrails.org/threading_and_code_execution.html).
|
78
|
+
This [may incur a performance impact for certain jobs](https://github.com/rails/rails/issues/43504),
|
79
|
+
I'm still exploring this.
|
78
80
|
|
81
|
+
#### ActiveRecord Query Cache
|
82
|
+
|
83
|
+
You may wish to
|
84
|
+
[turn off the ActiveRecord Query Cache](https://code.jjb.cc/turning-off-activerecord-query-cache-to-improve-memory-consumption-in-background-jobs)
|
85
|
+
for your jobs. You can do so with the around trigger:
|
86
|
+
|
87
|
+
```ruby
|
88
|
+
def schedule.around_trigger(job)
|
89
|
+
ActiveRecord::Base.uncached do
|
90
|
+
yield
|
91
|
+
end
|
92
|
+
end
|
93
|
+
```
|
79
94
|
|
80
95
|
### Non-Rails
|
81
96
|
|
@@ -165,6 +180,22 @@ schedule.every '1 day' do
|
|
165
180
|
end
|
166
181
|
```
|
167
182
|
|
183
|
+
#### shutdown behavior
|
184
|
+
|
185
|
+
Because of [this](https://stackoverflow.com/questions/69653842/),
|
186
|
+
if a shell job is running during shutdown, shutdown behavior seems to be changed
|
187
|
+
for _all_ running jobs - they no longer are allowed to finish within the timeout period.
|
188
|
+
Everything exits immediately.
|
189
|
+
|
190
|
+
Until this is figured out, if you are concerned about jobs exiting inelegantly,
|
191
|
+
you may want to run your shell jobs in their own separate clock process.
|
192
|
+
|
193
|
+
```
|
194
|
+
bundle exec rails runner bin/clock clocks/main_jobs.rb
|
195
|
+
bundle exec rails runner bin/clock clocks/shell_jobs.rb
|
196
|
+
```
|
197
|
+
|
198
|
+
|
168
199
|
### Rake tasks
|
169
200
|
|
170
201
|
You can run tasks from within the persistent runtime of ruby-clock, without
|
data/example-app/Gemfile.lock
CHANGED
data/example-app/README.md
CHANGED
data/lib/ruby-clock/version.rb
CHANGED
data/lib/ruby-clock.rb
CHANGED
@@ -42,7 +42,7 @@ module RubyClock
|
|
42
42
|
puts <<~MESSAGE
|
43
43
|
Because this is not a rails application, we do not know how to load your
|
44
44
|
rake tasks. You can do this yourself at the top of your Clockfile if you want
|
45
|
-
to run rake tasks from ruby-
|
45
|
+
to run rake tasks from ruby-clock.
|
46
46
|
MESSAGE
|
47
47
|
end
|
48
48
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ruby-clock
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Bachir
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-04-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rufus-scheduler
|
@@ -49,7 +49,6 @@ files:
|
|
49
49
|
- ".gitignore"
|
50
50
|
- CHANGELOG.md
|
51
51
|
- Gemfile
|
52
|
-
- Gemfile.lock
|
53
52
|
- LICENSE.txt
|
54
53
|
- README.md
|
55
54
|
- Rakefile
|
@@ -82,9 +81,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
82
81
|
version: 2.3.0
|
83
82
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
84
83
|
requirements:
|
85
|
-
- - "
|
84
|
+
- - ">="
|
86
85
|
- !ruby/object:Gem::Version
|
87
|
-
version:
|
86
|
+
version: '0'
|
88
87
|
requirements: []
|
89
88
|
rubygems_version: 3.2.22
|
90
89
|
signing_key:
|
data/Gemfile.lock
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
ruby-clock (0.8.0.rc2)
|
5
|
-
method_source
|
6
|
-
rufus-scheduler (~> 3.8)
|
7
|
-
|
8
|
-
GEM
|
9
|
-
remote: https://rubygems.org/
|
10
|
-
specs:
|
11
|
-
concurrent-ruby (1.1.9)
|
12
|
-
et-orbi (1.2.5)
|
13
|
-
tzinfo
|
14
|
-
fugit (1.5.2)
|
15
|
-
et-orbi (~> 1.1, >= 1.1.8)
|
16
|
-
raabro (~> 1.4)
|
17
|
-
method_source (1.0.0)
|
18
|
-
raabro (1.4.0)
|
19
|
-
rake (12.3.3)
|
20
|
-
rufus-scheduler (3.8.0)
|
21
|
-
fugit (~> 1.1, >= 1.1.6)
|
22
|
-
tzinfo (2.0.4)
|
23
|
-
concurrent-ruby (~> 1.0)
|
24
|
-
|
25
|
-
PLATFORMS
|
26
|
-
ruby
|
27
|
-
|
28
|
-
DEPENDENCIES
|
29
|
-
rake (~> 12.0)
|
30
|
-
ruby-clock!
|
31
|
-
|
32
|
-
BUNDLED WITH
|
33
|
-
2.2.23
|