Commit Graph

355 Commits

Author SHA1 Message Date
Gabi Stefanini
393f25bdba Uses queue adapter_method instead of ActiveJob::Base.queue_adapter
Change ActiveJob::Base.queue_adapter to use queue_adapter method to make test code consistent.
2016-10-24 22:25:48 -04:00
Gabi Stefanini
0d454d0806 Add examples of queue_adapter and perform_enqueued jobs to API Docs. 2016-10-21 11:59:01 -04:00
yuuji.yaginuma
77bdbb5f41 add missing closing tag [ci skip] 2016-10-14 09:15:51 +09:00
Rafael Mendonça França
d1fc0a5eb2
Removed deprecated support to passing the adapter class to .queue_adapter 2016-10-10 15:00:28 -03:00
Rafael Mendonça França
d861a1fcf8
Removed deprecated #original_exception in ActiveJob::DeserializationError 2016-10-10 14:55:20 -03:00
Jon Moss
743dba533e Merge pull request #26740 from y-yagi/update_retry_on_example
correct exception class in `retry_on` example [ci skip]
2016-10-08 19:51:42 -04:00
yuuji.yaginuma
be199dfae2 correct exception class in retry_on example [ci skip]
If the deadlock has occurred `ActiveRecord::Deadlocked` will raise.
Ref: #25107, #26059
2016-10-09 08:46:31 +09:00
Matthew Draper
cb0452e9a5 Fixnum and Bignum are deprecated in Ruby trunk
https://bugs.ruby-lang.org/issues/12739
2016-10-08 08:13:11 +10:30
yuuji.yaginuma
6a8e7fd8d8 fix link to resque [ci skip]
`1-x-stable` branch does not exist, `master` is 1.x branch.
Ref: http://words.steveklabnik.com/rescuing-resque-again
2016-09-20 08:56:05 +09:00
yuuji.yaginuma
0b2197774c use descendants to get class that inherited ActiveJob::Base
`subclasses` get only child classes.
Therefore, if create a job common parent class as `ApplicationJob`,
inherited class does not get properly.
2016-09-05 09:21:10 +09:00
Xavier Noria
bb1ecdcc67 fixes remaining RuboCop issues [Vipul A M, Xavier Noria] 2016-09-01 23:41:49 +02:00
Rafael Mendonça França
0510208dd1
Add load hooks to all tests classes
Usually users extends tests classes doing something like:

    ActionView::TestCase.include MyCustomTestHelpers

This is bad because it will load the ActionView::TestCase right aways
and this will load ActionController::Base making its on_load hooks to
execute early than it should.

One way to fix this is using the on_load hooks of the components like:

    ActiveSupport.on_load(:action_view) do
      ActionView::TestCase.include MyCustomTestHelpers
    end

The problem with this approach is that the test extension will be only
load when ActionView::Base is loaded and this may happen too late in the
test.

To fix this we are adding hooks to people extend the test classes that
will be loaded exactly when the test classes are needed.
2016-08-25 04:22:48 -03:00
Rafael Mendonça França
7f4b16ed83
Merge pull request #26205 from pedaling-corp/fix/active-job-resque
Add @queue variable to JobWrapper
2016-08-23 00:39:39 -03:00
yuuji.yaginuma
88f9a1540a correct exception class in retry_on example [ci skip]
If the deadlock has occurred `ActiveRecord::Deadlocked` will raise.
Ref: #25107, #26059
2016-08-20 17:21:14 +09:00
InJung Chung
9f6461a28c Added instance variable @queue to JobWrapper.
This will fix issues in [resque-scheduler](https://github.com/resque/resque-scheduler) `#job_to_hash` method,
so we can use `#enqueue_delayed_selection`, `#remove_delayed` method in resque-scheduler smoothly.
2016-08-19 17:10:27 +09:00
David Heinemeier Hansson
a1e4c197cb Yield the job instance so you have access to things like job.arguments on the custom logic after retries fail 2016-08-16 16:01:59 -07:00
Rafael Mendonça França
55f9b8129a
Add three new rubocop rules
Style/SpaceBeforeBlockBraces
Style/SpaceInsideBlockBraces
Style/SpaceInsideHashLiteralBraces

Fix all violations in the repository.
2016-08-16 04:30:11 -03:00
Vipul A M
8b984161d6
Pass over changelogs [ci skip] 2016-08-10 09:33:13 +05:30
Xavier Noria
a9dc45459a code gardening: removes redundant selfs
A few have been left for aesthetic reasons, but have made a pass
and removed most of them.

Note that if the method `foo` returns an array, `foo << 1`
is a regular push, nothing to do with assignments, so
no self required.
2016-08-08 01:12:38 +02:00
Ryuta Kamizono
762e3f05f3 Add Style/EmptyLines in .rubocop.yml and remove extra empty lines 2016-08-07 17:50:59 +09:00
Xavier Noria
b326e82dc0 applies remaining conventions across the project 2016-08-06 20:20:22 +02:00
Xavier Noria
80e66cc4d9 normalizes indentation and whitespace across the project 2016-08-06 20:16:27 +02:00
Xavier Noria
411ccbdab2 remove redundant curlies from hash arguments 2016-08-06 19:44:11 +02:00
Xavier Noria
301ce2a6d1 modernizes hash syntax in activejob 2016-08-06 19:36:54 +02:00
Xavier Noria
e6ab70c439 applies new string literal convention to the rest of the project
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 19:28:46 +02:00
Xavier Noria
adca8154c6 applies new string literal convention in the gemspecs
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 19:27:12 +02:00
Xavier Noria
bde6547bb6 applies new string literal convention in activejob/test
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 18:41:18 +02:00
Xavier Noria
93c9534c98 applies new string literal convention in activejob/lib
The current code base is not uniform. After some discussion,
we have chosen to go with double quotes by default.
2016-08-06 18:40:07 +02:00
David Heinemeier Hansson
01a69e27a4 Offer invitations to use retry_on/discard_on for common cases 2016-08-04 14:57:10 -07:00
David Heinemeier Hansson
4f5a9890b7 Guard against jobs that were persisted before we started counting executions by zeroing out nil counters 2016-08-03 14:30:39 -07:00
David Heinemeier Hansson
b53da9e90b Amend the CHANGELOG 2016-08-02 15:04:45 -07:00
David Heinemeier Hansson
7efd77fae5 Fix tests against ActiveSupport::Durations 2016-08-02 14:27:01 -07:00
David Heinemeier Hansson
111227c0df Please Rubocup 2016-08-02 12:28:16 -07:00
David Heinemeier Hansson
3118911335 Not needed 2016-08-01 20:29:29 -07:00
David Heinemeier Hansson
9d8d4ee05e Allow for custom handling of exceptions that persist beyond the retry attempts 2016-08-01 16:51:11 -07:00
David Heinemeier Hansson
0be5d5d4c4 Add exponentially_longer and custom wait algorithms 2016-08-01 16:44:29 -07:00
David Heinemeier Hansson
08a92d47b0 Use descriptive exception names 2016-08-01 16:09:16 -07:00
David Heinemeier Hansson
a4fc7dc957 Executions counting is not a serialization concern
Let’s do it when we actually execute instead. Then the tests dealing
with comparable serializations won’t fail either!
2016-08-01 16:02:50 -07:00
David Heinemeier Hansson
779148d390 Reraise instead of swallow exceptions that occur beyond the retry attempts 2016-07-29 15:15:31 -07:00
David Heinemeier Hansson
f931290e58 Proper logging when we bail on retrying after X attempts 2016-07-29 15:07:50 -07:00
David Heinemeier Hansson
8457e5eb1d Allow retries to happen with different priority and queue 2016-07-29 14:23:39 -07:00
David Heinemeier Hansson
b00214d214 Require time extension for 3.seconds default 2016-07-29 14:21:02 -07:00
David Heinemeier Hansson
504a7d0530 Mention defaults 2016-07-29 14:20:29 -07:00
David Heinemeier Hansson
4139b14492 Satisfy pedantic rubocop whitespace detection 2016-07-29 13:59:40 -07:00
David Heinemeier Hansson
5ce59f456f Remove needless require 2016-07-29 13:57:37 -07:00
David Heinemeier Hansson
8b5c04e423 Add retry_on/discard_on for better exception handling 2016-07-29 13:54:55 -07:00
Azzurrio
80e825915c Fix accessing provider_job_id inside active jobs for sidekiq adapter 2016-07-28 04:12:15 +02:00
Vipul A M
8dd9bb6e9b
Fix AJ tests on ruby 2.4 being causes since classes are unified for Integer, and we create test name nased on arg class. Append ar as well to the test name 2016-07-09 16:24:03 -07:00
Jean Boussier
be491ecec2 Fix jobs overriding AJ::Base#logger 2016-06-17 13:04:17 -04:00
Steve Lounsbury
38c187b0cc Provide the ability to override the queue adapter used by jobs under
test.

This PR adds a method called `queue_adapter_for_test` to
`ActiveJob::TestHelper`. This method is expected to provide the queue
adapter to be used for jobs under test. It maintains the current
behaviour by defaulting to an instance of
`ActiveJob::QueueAdapter::TestAdapter`. Tests that include
`ActiveJob::TestHelper` or extend from `ActiveJob::TestCase` can provide
a custom queue adapter by overriding `queue_adapter_for_test` in their
class.
2016-06-11 15:18:52 -04:00