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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a7c7609e955fa16eb1971866dea67a1e0f224273
4
- data.tar.gz: 9327345d876bda0bddc98c9e01f980e4cba87ef0
3
+ metadata.gz: bbc371d18529aa76cdb47358c395712a623f95c6
4
+ data.tar.gz: c48f5ddda64e71cafac940cb3ce4af81691ae2ba
5
5
  SHA512:
6
- metadata.gz: a660dbffcd068be6bdb005eabde7c9447715dcb26e5f0fae5395ecc14730ecd58511434a70e775953e7335363a0376998f90daba97406f14c7b37b3335fd8484
7
- data.tar.gz: 57e9029ede9d7603e88428c966c24e8e3d0de5f91f58c4cee4ff36aad77714576379b612579a2571f04b3fa1251043511e3e8ef37a7677f6c0a0bf7a86ee02eb
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.
@@ -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 = 5.minutes.from_now if next_job_run.nil? or (next_job_run - DateTime.now)/60 > 5
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
@@ -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 either cron: or interval:! When should the task run?'
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?
@@ -1,3 +1,3 @@
1
1
  module Arask
2
- VERSION = '1.1.2'
2
+ VERSION = '1.1.3'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: arask
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Esben Damgaard