arask 1.1.2 → 1.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +6 -0
- data/lib/arask.rb +1 -1
- data/lib/arask/setup.rb +1 -3
- data/lib/arask/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bbc371d18529aa76cdb47358c395712a623f95c6
|
4
|
+
data.tar.gz: c48f5ddda64e71cafac940cb3ce4af81691ae2ba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2061665d541fc6bc7758b0a595161b18820f267ea90e3bb56edead27f7bc666fe78d765405c2f86e69d11d744052a918a11a98bdfd76463a745a3f81c34a68d5
|
7
|
+
data.tar.gz: 1338c50d342cd77ff4d26bc273f518c276e1174369fcc5db0a27938573302dfd148dafd6243dcdb7126027f29682dd1c50902aab20122c603cbba5183d58b87f
|
data/README.md
CHANGED
@@ -61,6 +61,12 @@ The interval starts when the task has started running. If a task with the interv
|
|
61
61
|
|
62
62
|
## Todos
|
63
63
|
* Have a "try again" feature. For instance `arask.create script: 'raise "I failed"', interval: :daily, fail_retry: 5.minutes, retry_at_most: 2`
|
64
|
+
* Be able to run a block when an exception occurs. `arask.on_exception do <code> end`
|
65
|
+
* Be able to specify line and number that failed for an exception:
|
66
|
+
```ruby
|
67
|
+
file,line,_ = caller.first.split(' ')[0].split(':')
|
68
|
+
fileline = File.readlines(file)[line.to_i - 1].strip
|
69
|
+
```
|
64
70
|
|
65
71
|
## Setup for Heroku
|
66
72
|
None. But if you use a hobby dyno and it falls to sleep, so will Arask. As soon as the dyno wakes up, Arask will run any pending jobs.
|
data/lib/arask.rb
CHANGED
@@ -25,7 +25,7 @@ module Arask
|
|
25
25
|
begin
|
26
26
|
next_job_run = AraskJob.order(execute_at: :asc).first.try(:execute_at)
|
27
27
|
# At least check database for jobs every 5 minutes
|
28
|
-
next_job_run =
|
28
|
+
next_job_run = 1.day.from_now if next_job_run.nil? or (next_job_run - DateTime.now)/60/60 > 24
|
29
29
|
RunJobs.set(wait_until: next_job_run).perform_later
|
30
30
|
rescue
|
31
31
|
end
|
data/lib/arask/setup.rb
CHANGED
@@ -7,11 +7,9 @@ module Arask
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def self.create(script: nil, task: nil, job: nil, interval: nil, cron: nil, run_first_time: false)
|
10
|
-
file,line,_ = caller.first.split(' ')[0].split(':')
|
11
|
-
p File.readlines(file)[line.to_i - 1].strip
|
12
10
|
interval = parse_interval_or_cron(interval, cron)
|
13
11
|
if interval.nil?
|
14
|
-
puts 'Arask: You did not specify
|
12
|
+
puts 'Arask: You did not specify neither cron: nor interval:! When should the task run?'
|
15
13
|
return
|
16
14
|
end
|
17
15
|
unless task.nil?
|
data/lib/arask/version.rb
CHANGED