rufus-scheduler 3.8.0 → 3.8.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +12 -0
- data/CREDITS.md +6 -1
- data/LICENSE.txt +1 -1
- data/README.md +17 -6
- data/lib/rufus/scheduler/jobs_repeat.rb +2 -0
- data/lib/rufus/scheduler.rb +23 -11
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9fbe0f73068129b96196031b141f480f830e3110e35d3c5eaa2206530b1ae536
|
4
|
+
data.tar.gz: bec310a43820928b8d342b5b3602edf8cb27aaca8995e0a18073d70dfd3839f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3e8edfd4df2ddbb0f8026ffa13fff69f9f4bd045da1638fe5ac38610992e0f7d173b20a27ad1833760d6fee62d41b5b160978e107dbc55a1b9d07dfaa62444ad
|
7
|
+
data.tar.gz: 412bb7e80546c5cd13bf8875f928ce6920a9e62774d296db83935adbfee56069cbb2729bb4640962351297cd55b8b5cfb92facfec38e7cb92b3ef9f7446c7283
|
data/CHANGELOG.md
CHANGED
@@ -2,6 +2,18 @@
|
|
2
2
|
# CHANGELOG.md
|
3
3
|
|
4
4
|
|
5
|
+
### rufus-scheduler 3.8.2 - released 2022-07-12
|
6
|
+
|
7
|
+
* Prevent error in shutdown when @thread is current Thread, gh-337
|
8
|
+
* Rescue errors on the scheduling thread, gh-335
|
9
|
+
|
10
|
+
|
11
|
+
### rufus-scheduler 3.8.1 - released 2022-01-11
|
12
|
+
|
13
|
+
* Suppress warning about @resume_discard_past
|
14
|
+
* Suppress warning about unused variable, solackerman gh-332
|
15
|
+
|
16
|
+
|
5
17
|
### rufus-scheduler 3.8.0 - released 2021-07-14
|
6
18
|
|
7
19
|
* Add #source_location to Job, gh-322
|
data/CREDITS.md
CHANGED
@@ -4,7 +4,12 @@
|
|
4
4
|
|
5
5
|
## Contributors
|
6
6
|
|
7
|
-
*
|
7
|
+
* Bence Monus https://github.com/cromega gh-337 on_error and friends
|
8
|
+
* Talia Wong https://github.com/blowfishpro gh-335 on_error and friends
|
9
|
+
* Konstantin https://github.com/fa11enangel gh-334 nodejitsu link
|
10
|
+
* Olle Jonsson https://github.com/olleolleolle gh-333
|
11
|
+
* Sol Ackerman https://github.com/solarckerman gh-332
|
12
|
+
* John Bachir https://github.com/jjb gh-310 gh-327
|
8
13
|
* Daniel Berger https://github.com/djberg96 gh-300
|
9
14
|
* Ceyhun Onur https://github.com/ceyonur parse_cron no_error: true
|
10
15
|
* Darwin Wu https://github.com/dwaxe Rails initializer vs tests change
|
data/LICENSE.txt
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
|
2
|
-
Copyright (c) 2005-
|
2
|
+
Copyright (c) 2005-2022, John Mettraux, jmettraux@gmail.com
|
3
3
|
|
4
4
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
5
5
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
@@ -133,7 +133,7 @@ Yes, issues can be reported in [rufus-scheduler issues](https://github.com/jmett
|
|
133
133
|
### faq
|
134
134
|
|
135
135
|
* [It doesn't work...](https://www.chiark.greenend.org.uk/~sgtatham/bugs.html)
|
136
|
-
* [I want a refund](https://blog.nodejitsu.com/getting-refunds-on-open-source-projects)
|
136
|
+
* [I want a refund](https://web.archive.org/web/20160425034214/http://blog.nodejitsu.com/getting-refunds-on-open-source-projects/)
|
137
137
|
* [Passenger and rufus-scheduler](https://stackoverflow.com/questions/18108719/debugging-rufus-scheduler/18156180#18156180)
|
138
138
|
* [Passenger and rufus-scheduler (2)](https://stackoverflow.com/questions/21861387/rufus-cron-job-not-working-in-apache-passenger#answer-21868555)
|
139
139
|
* [Passenger in-depth spawn methods](https://www.phusionpassenger.com/library/indepth/ruby/spawn_methods/)
|
@@ -860,7 +860,11 @@ require 'rufus-scheduler'
|
|
860
860
|
s = Rufus::Scheduler.new
|
861
861
|
|
862
862
|
def s.on_error(job, err)
|
863
|
-
|
863
|
+
if job
|
864
|
+
p [ 'error in scheduled job', job.class, job.original, err.message ]
|
865
|
+
else
|
866
|
+
p [ 'error while scheduling', err.message ]
|
867
|
+
end
|
864
868
|
rescue
|
865
869
|
p $!
|
866
870
|
end
|
@@ -1649,14 +1653,16 @@ If you don't want rufus-scheduler to trigger anything while running the Ruby on
|
|
1649
1653
|
|
1650
1654
|
require 'rufus-scheduler'
|
1651
1655
|
|
1652
|
-
|
1656
|
+
return if defined?(Rails::Console) || Rails.env.test? || File.split($PROGRAM_NAME).last == 'rake'
|
1657
|
+
#
|
1658
|
+
# do not schedule when Rails is run from its console, for a test/spec, or
|
1659
|
+
# from a Rake task
|
1653
1660
|
|
1654
|
-
return if defined?(Rails::Console) || Rails.env.test? || File.split($0).last == 'rake'
|
1655
1661
|
# return if $PROGRAM_NAME.include?('spring')
|
1662
|
+
#
|
1656
1663
|
# see https://github.com/jmettraux/rufus-scheduler/issues/186
|
1657
1664
|
|
1658
|
-
|
1659
|
-
# from a Rake task
|
1665
|
+
s = Rufus::Scheduler.singleton
|
1660
1666
|
|
1661
1667
|
s.every '1m' do
|
1662
1668
|
Rails.logger.info "hello, it's #{Time.now}"
|
@@ -1664,6 +1670,8 @@ s.every '1m' do
|
|
1664
1670
|
end
|
1665
1671
|
```
|
1666
1672
|
|
1673
|
+
(Beware later version of Rails where Spring takes care pre-running the initializers. Running `spring stop` or disabling Spring might be necessary in some cases to see changes to initializers being taken into account.)
|
1674
|
+
|
1667
1675
|
|
1668
1676
|
### rails server -d
|
1669
1677
|
|
@@ -1680,6 +1688,9 @@ These are two well crafted articles on process daemonization, please read them:
|
|
1680
1688
|
|
1681
1689
|
If, anyway, you need something like `rails server -d`, why not try `bundle exec unicorn -D` instead? In my (limited) experience, it worked out of the box (well, had to add `gem 'unicorn'` to `Gemfile` first).
|
1682
1690
|
|
1691
|
+
### executor / reloader
|
1692
|
+
|
1693
|
+
You might benefit from wraping your scheduled code in the executor or reloader. Read more here: https://guides.rubyonrails.org/threading_and_code_execution.html
|
1683
1694
|
|
1684
1695
|
## support
|
1685
1696
|
|
data/lib/rufus/scheduler.rb
CHANGED
@@ -9,7 +9,7 @@ module Rufus; end
|
|
9
9
|
|
10
10
|
class Rufus::Scheduler
|
11
11
|
|
12
|
-
VERSION = '3.8.
|
12
|
+
VERSION = '3.8.2'
|
13
13
|
|
14
14
|
EoTime = ::EtOrbi::EoTime
|
15
15
|
|
@@ -443,10 +443,14 @@ class Rufus::Scheduler
|
|
443
443
|
ms = {}; mutexes.each { |k, v| ms[k] = v.locked? }
|
444
444
|
|
445
445
|
stderr.puts("{ #{pre} rufus-scheduler intercepted an error:")
|
446
|
-
|
447
|
-
|
448
|
-
|
449
|
-
|
446
|
+
if job
|
447
|
+
stderr.puts(" #{pre} job:")
|
448
|
+
stderr.puts(" #{pre} #{job.class} #{job.original.inspect} #{job.opts.inspect}")
|
449
|
+
stderr.puts(" #{pre} #{job.source_location.inspect}")
|
450
|
+
# TODO: eventually use a Job#detail or something like that
|
451
|
+
else
|
452
|
+
stderr.puts(" #{pre} job: (error did not occur in a job)")
|
453
|
+
end
|
450
454
|
stderr.puts(" #{pre} error:")
|
451
455
|
stderr.puts(" #{pre} #{err.object_id}")
|
452
456
|
stderr.puts(" #{pre} #{err.class}")
|
@@ -530,7 +534,7 @@ class Rufus::Scheduler
|
|
530
534
|
|
531
535
|
unlock
|
532
536
|
|
533
|
-
@thread.join
|
537
|
+
@thread.join unless @thread == Thread.current
|
534
538
|
end
|
535
539
|
alias stop shutdown
|
536
540
|
|
@@ -583,7 +587,7 @@ class Rufus::Scheduler
|
|
583
587
|
r =
|
584
588
|
begin
|
585
589
|
@join_queue.pop(true)
|
586
|
-
rescue ThreadError
|
590
|
+
rescue ThreadError
|
587
591
|
# #<ThreadError: queue empty>
|
588
592
|
false
|
589
593
|
end
|
@@ -630,12 +634,20 @@ class Rufus::Scheduler
|
|
630
634
|
Thread.new do
|
631
635
|
|
632
636
|
while @started_at do
|
637
|
+
begin
|
638
|
+
|
639
|
+
unschedule_jobs
|
640
|
+
trigger_jobs unless @paused_at
|
641
|
+
timeout_jobs
|
633
642
|
|
634
|
-
|
635
|
-
trigger_jobs unless @paused_at
|
636
|
-
timeout_jobs
|
643
|
+
sleep(@frequency)
|
637
644
|
|
638
|
-
|
645
|
+
rescue => err
|
646
|
+
#
|
647
|
+
# for `blocking: true` jobs mostly
|
648
|
+
#
|
649
|
+
on_error(nil, err)
|
650
|
+
end
|
639
651
|
end
|
640
652
|
|
641
653
|
rejoin
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: rufus-scheduler
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.8.
|
4
|
+
version: 3.8.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Mettraux
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: fugit
|