-
Notifications
You must be signed in to change notification settings - Fork 201
/
TODO.txt
151 lines (141 loc) · 5.95 KB
/
TODO.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
[o] merge schedule_queue and unschedule_queue (and merge [un]schedule steps)
[x] OR stop using queue, since we've got the thread-safe JobArray
[x] if possible, drop the mutex in JobArray
NO, that mutex is necessary for Scheduler#jobs (on JRuby an co)...
[o] named mutexes
[o] drop the schedule queue, rely on the mutex in JobArray
[o] def jobs; (@jobs.to_a + running_jobs).uniq; end
[o] replace @unscheduled by @unscheduled_at
[o] make sure #jobs doesn't return unscheduled jobs
[o] job tags and find_by_tag(t) (as in rs 2.x)
[o] require tzinfo anyway (runtime dep)
[o] document frequency
[o] accept :frequency => '5s'
[o] timeout (as in rufus-scheduler 2.x)
[o] Rufus::Scheduler#running_jobs (as in rufus-scheduler 2.x)
[o] Rufus::Scheduler#terminate_all_jobs
[o] Rufus::Scheduler::Job#kill
[x] Rufus::Scheduler#kill_all_jobs
[o] Rufus::Scheduler#shutdown(:terminate or :kill (or nothing))
[o] RepeatJob #pause / #resume (think about discard past)
[o] Rufus::Scheduler.start_new (backward comp) (with deprec note?)
[o] pass job to scheduled block? What does rs 2.x do?
[o] :first[_in|_at] for RepeatJob
[o] :last[_in|_at] for RepeatJob
[o] :times for RepeatJob (how many recurrences)
[o] fix issue #39 (first_at parses as UTC)
[o] about issue #43, raise if cron/every job frequency < scheduler frequency
[o] unlock spec/parse_spec.rb:30 "parse datimes with timezones"
[o] some kind of Schedulable (Xyz#call(job, time))
[o] add Jruby and Rubinius to Travis
[o] make Job #first_at= / #last_at= automatically parse strings?
[o] bring in Kratob's spec about mutex vs timeout and adapt 3.0 to it,
https://github.com/jmettraux/rufus-scheduler/pull/67
[x] :unschedule_if => lambda { |job| ... }
[o] OR look at how it was done in rs 2.0.x, some return value?
no, pass the job as arg to the block, then let the block do job.unschedule
so, document schedule.every('10d') { |j| j.unschedule if x?() }
[x] remove the time in job.trigger(time)
[o] add spec for job queued then unscheduled
[o] add spec for Scheduler#shutdown and work threads
[o] at some point, bring back rbx19 to Travis
[o] move the parse/util part of scheduler.rb to util.rb
[o] rescue KillSignal in job thread loop to kill just the job
[o] add spec for raise if scheduling a job while scheduler is shutting down
[o] schedule_in(2.days.from_now) {}
at and in could understand each others time parameter, ftw...
use the new #parse_to_time? no
[o] do repeat jobs reschedule after timing out? yes
[o] schedule_interval('20s')?
[x] Scheduler#reschedule(job) (new copy of the job)
[x] #free_all_work_threads is missing an implementation
[x] rescue StandardError
:on_error => :crash[_scheduler]
:on_error => :ignore
:on_error => ...
[o] on_error: what about TimeoutError in that scheme?
TimeoutError goes to $stderr, like a normal error
[o] link to SO for support
- sublink to "how to report bugs effectively"
[o] link to #ruote for support
[x] lockblock? pass a block to teach the scheduler how to lock?
is not necessary, @scheduler = Scheduler.new if should_start?
the surrounding Ruby code checks
[o] introduce job "vars", as in
http://stackoverflow.com/questions/18202848/how-to-have-a-variable-that-will-available-to-particular-scheduled-task-whenever
or job['key'] Job #[] and #[]=, as with Thread #[] #[]=
job-local variables #keys #key?
[o] thread-safety for job-local variables?
[x] discard past? discard_past => true or => "1d"
default would be discard_past => "1m" or scheduler freq * 2 ?
jobs would adjust their next_time until it fits the window...
~~ discard past by default
[o] expanded block/schedulable (it's "callable")
```
scheduler.every '10m' do
def pre
return false if Backend.down?
# ...
end
def post
# ...
end
def trigger
puts "oh hai!"
end
end
```
or something like that...
...
OR accept a class (and instantiate it the first time)
```
scheduler.every '10m', Class.new do
def call(job, time)
# ...
end
end
```
the job contains the instance in its @callable
[x] add spec case for corner case in Job#trigger (overlap vs reschedule) !!!
[o] rethink job array vs job set for #scheduled?
[x] introduce common parent class for EveryJob and IntervalJob
[o] create spec/ at_job_spec.rb, repeat_job_spec.rb, cron_job_spec.rb, ...
[x] ensure EveryJob do not schedule in the past (it's already like that)
[o] CronLine#next_time should return a time with subseconds chopped off
[o] drop min work threads setting?
[o] thread pool something? Thread upper limit?
[o] Rufus::Scheduler.singleton, Rufus::Scheduler.s
[o] EveryJob#first_at= and IntervalJob#first_at= should alter @next_time
[o] scheduler.schedule duration/time/cron ... for at/in/cron
(not every, nor interval)
scheduler.repeat time/cron ... for every/cron
[o] :lockfile => x, timestamp, process_id, thread_id...
warning: have to clean up that file on exit... or does the scheduler
timestamps it?
[ ] develop lockfile timestamp thinggy
~ if the timestamp is too old (twice the default frequency?) then
lock [file] take over...
Is that really what we want all the time?
[ ] idea: :mutex => x and :skip_on_mutex => true ?
would prevent blocking/waiting for the mutex to get available
:mutex => [ "mutex_name", true ]
:mutex => [ [ "mutex_name", true ], [ "other_mutex_name", false ] ]
[ ] bring back EM (but only EM.defer ?) :defer => true (Job or Scheduler
or both option?)
[ ] prepare a daemon, trust daemon-kit for that
[ ] :if => lambda { |job, time| ... } why not?
:unless => lambda { ...
:block => lambda { ...
can help get the block themselves leaner
#
investigate guards for schedulables... def if_guard; ...; end
[ ] scheduler.every '10', Class.new do
def call(job, time)
# might fail...
end
def on_error(err, job)
# catches...
end
end
~~~
[ ] scheduler.at('chronic string', chronic_options...)