aboutsummaryrefslogtreecommitdiffstats
path: root/activejob
Commit message (Collapse)AuthorAgeFilesLines
* Amend CVE note and security guide section wordingsGannon McGibbon2018-11-061-3/+3
| | | | | | | Reword first sentence of dep management and CVE section of security guide. Also, reword and move gemspec notes above deps. [ci skip]
* Add CVE note to security guide and gemspecsGannon McGibbon2018-11-061-0/+3
| | | | [ci skip]
* Restore HWIA support to AJ::Arguments.deserializeGannon McGibbon2018-10-303-1/+13
| | | | | Restore HashWithIndifferentAccess support to ActiveJob::Arguments.deserialize.
* Merge pull request #33972 from bogdanvlviv/follow-up-33897Rafael França2018-10-302-9/+13
|\ | | | | Improve `enqueue_retry.active_job` message
| * Improve `enqueue_retry.active_job` messagebogdanvlviv2018-09-252-9/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since #33751 was added `enqueue_retry.active_job` instrumentation to the `retry_on` method, then #33897 moved the instrumentation to `retry_job` method in order to ensure that this method publish `enqueue_retry.active_job` notification too. See related discussion https://github.com/rails/rails/pull/33751#discussion_r214140008 Since `enqueue_retry.active_job` moved to `retry_job`, there is no guarantee that payload of `enqueue_retry.active_job` would have `:error`. See test `LoggingTest#test_enqueue_retry_logging_on_retry_job` as example of that case. Related to https://github.com/rails/rails/pull/33897#discussion_r219707024 I think we can improve notification of `enqueue_retry.active_job`: - If there is no `event.payload[:error]`, then publish like "Retrying RescueJob in 3 seconds." only. - If `event.payload[:wait]` is `nil`, then publish "Retrying RescueJob in 0 seconds." instead of "Retrying RescueJob in nil seconds." - If there is `event.payload[:error]`, then publish "Retrying RescueJob in 3 seconds, due to a DefaultsError.". - Change the type of the message from `error` to `info.` Also, this commit removes part of messages - "The original exception was #{ex.cause.inspect}." of `enqueue_retry.active_job`, `retry_stopped.active_job`, and `discard.active_job` since I haven't found it useful. Please let me know whether you agree with that?
* | Merge pull request #34204 from XrXr/aj-test-helper-argsRafael França2018-10-243-15/+20
|\ \ | | | | | | Include deserialized arguments in jobs returned by AJ test helpers
| * | Include deserialized arguments in jobs returned by AJ test helpersAlan Wu2018-10-123-15/+20
| | | | | | | | | | | | | | | | | | | | | | | | `assert_enqueued_with` and `assert_performed_with` return a instantiated instance of the matching job for further assertion (#21010). Before this commit the `arguments` method on the returned instance returns a serialized version of the arguments.
* | | Remove an extra `@mutex.synchronize`yuuji.yaginuma2018-10-191-12/+1
| | | | | | | | | | | | | | | | | | | | | | | | Since `@mutex.synchronize` is enforced in the `ensure_connection!` method, there is no need to do so on the caller side. https://github.com/jondot/sneakers/blob/c1b47f9c5d5a95da728bbe1700795790e4efbb12/lib/sneakers/publisher.rb#L22-L26 Due to this, `ThreadError(deadlock; recursive locking)` has occurred.
* | | Return a non zero code when can not connect to backend on CIyuuji.yaginuma2018-10-194-4/+8
| | |
* | | Clarify docs of `ActiveJob::TestHelper` [ci skip]bogdanvlviv2018-10-161-3/+3
| | | | | | | | | | | | | | | | | | | | | I found a few sentences that should be updated as well. See https://github.com/rails/rails/pull/33571#discussion_r209435886 Follow up #33571
* | | [ci skip] Fix link to Concurrent::ThreadPoolExecutor docsOrhan Toy2018-10-111-1/+1
| | |
* | | Remove unnecessary use of `included` in ActiveJob::CoreAlan Wu2018-10-051-21/+19
|/ / | | | | | | | | Using `included` to define `attr_acessor` and `attr_writer` is causing these methods to not show up in the documentation.
* | Add `Style/RedundantFreeze` to remove redudant `.freeze`Yasuo Honda2018-09-292-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since Rails 6.0 will support Ruby 2.4.1 or higher `# frozen_string_literal: true` magic comment is enough to make string object frozen. This magic comment is enabled by `Style/FrozenStringLiteralComment` cop. * Exclude these files not to auto correct false positive `Regexp#freeze` - 'actionpack/lib/action_dispatch/journey/router/utils.rb' - 'activerecord/lib/active_record/connection_adapters/sqlite3_adapter.rb' It has been fixed by https://github.com/rubocop-hq/rubocop/pull/6333 Once the newer version of RuboCop released and available at Code Climate these exclude entries should be removed. * Replace `String#freeze` with `String#-@` manually if explicit frozen string objects are required - 'actionpack/test/controller/test_case_test.rb' - 'activemodel/test/cases/type/string_test.rb' - 'activesupport/lib/active_support/core_ext/string/strip.rb' - 'activesupport/test/core_ext/string_ext_test.rb' - 'railties/test/generators/actions_test.rb'
* | Documentation clarity in ActiveJob::TestHelper [ci skip] (#33571)Mohit Natoo2018-09-281-8/+8
| | | | | | | | | | | | | | * Documentation clarity in ActiveJob::TestHelper [ci skip] * Documentation for options [Mohit Natoo + Rafael Mendonça França]
* | Merge pull request #33570 from mohitnatoo/queue_adapter_name_docRyuta Kamizono2018-09-281-0/+2
|\ \ | | | | | | | | | | | | Documentation for queue_adapter_name method in ActiveJob::QueueAdapter [ci skip]
| * | Documentation for queue_adapter_name method in ActiveJob::QueueAdapter [ci skip]Mohit Natoo2018-08-101-0/+2
| | |
* | | Add a way to check for subset of arguments when performing jobs:Edouard CHIN2018-09-263-2/+100
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - When calling `assert_performed_with`/`assert_enqueued_with`, the +args+ needs to match exactly what the job get passed. Some jobs can have lot of arguments, or even a simple hash argument has many key. This is not convenient to test as most tests doesn't need to check if the arguments matches perfectly. This PR make it possible to only check if a subset of arguments were passed to the job.
* | | Change the empty block style to have space inside of the blockRafael Mendonça França2018-09-251-1/+1
| |/ |/|
* | Extract `instrument` method.Kasper Timm Hansen2018-09-231-26/+11
| | | | | | | | Similar to Action View's and Action Controller's instrument helpers.
* | Fix "warning: shadowing outer local variable - job"yuuji.yaginuma2018-09-221-2/+2
| |
* | Merge pull request #33906 from dark-panda/ignore-psqlrc-when-using-psqlRafael França2018-09-202-4/+4
|\ \ | | | | | | Ignore psqlrc files when executing psql commands
| * | Ignore psqlrc files when executing psql commandsJ Smith2018-09-172-4/+4
| | | | | | | | | | | | | | | | | | psqlrc files can affect the execution of commands in ways that can hold up execution by blocking or otherwise cause unexpected side effects and should best be ignored when using psql programmatically.
* | | Make `assert_<enqueued|performed>_with()` compare hashes ignoring order of keysSharang Dashputre2018-09-213-9/+38
| | | | | | | | | | | | The test helpers now treat `{ a: 1, b: 2 }` and `{ b: 2, a: 1 }` as equals
* | | Merge pull request #33897 from bogdanvlviv/follow-up-33751Rafael França2018-09-183-12/+23
|\ \ \ | |/ / |/| | Follow up #33751
| * | `retry_job` should publish `enqueue_retry.active_job` notificationbogdanvlviv2018-09-163-12/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also this commit removes `:wait` from payload of `retry_stopped.active_job`. Related to https://github.com/rails/rails/pull/33751#discussion_r214140008 Follow up #33751 /cc @kaspth, @rafaelfranca
* | | Print correct rake command on running AJ integration testsbogdanvlviv2018-09-171-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Currently when executing `bundle exec rake test:integration` under `activejob/` derectory, it prints helpful info like: ``` (snip) *** rake aj:integration:async *** (snip) *** rake aj:integration:delayed_job *** (snip) ``` but there is no defined `:aj` scope in `activejob/Rakefile`, so I think output should be like: ``` (snip) *** rake test:integration:async *** (snip) *** rake test:integration:delayed_job *** (snip) ``` By the way `rake test:integration` doesn't work if execute it without prepending `bundle exec` to that command. It is probably what we should fix too.
* | Update arguments.rb [ci skip]Sharang Dashputre2018-09-131-1/+1
| | | | | | | | Fix typo `Instrinsic` -> `Intrinsic`
* | Add changelog entries for #33849 [ci skip]bogdanvlviv2018-09-131-0/+4
| | | | | | | | | | | | | | Since these changes related to the public API, I think we should add changelog entries. Related to #33838, #33849
* | Merge pull request #33849 from ↵Rafael França2018-09-121-0/+4
|\ \ | | | | | | | | | | | | ricardotk002/include-helpers-action-dispatch-integration-test Include test helpers in ActionDispatch::IntegrationTest
| * | Include test helpers when ActionDispatch::IntegrationTest is loadedRicardo Díaz2018-09-121-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | As @dhh brings up, the point of `ActionDispatch::IntegrationTest` is to allow users to test the integration of all the pieces called by a controller. Asserting about the emails and jobs queued is part of that task. This commit includes the `ActionMailer::TestHelper` and `ActiveJob::TestHelper` modules when the ActionMailer and ActiveJob railties are initialized respectively.
* | | Update test_helper_test.rbSharang Dashputre2018-09-121-1/+1
|/ / | | | | Fix typo `wiht` -> `with`
* | Merge pull request #33823 from stoodfarback/aj_backburner_fix_priorityRafael França2018-09-102-2/+14
|\ \ | | | | | | ActiveJob Backburner adapter: fix priority
| * | ActiveJob Backburner adapter: fix prioritystoodfarback2018-09-072-2/+14
| | | | | | | | | | | | | | | | | | | | | The priority wasn't being passed from ActiveJob to Backburner, despite priority being supported. This also brings it inline with the docs, which mark Backburner as supporting priorities in the "Backend Features" table: https://api.rubyonrails.org/classes/ActiveJob/QueueAdapters.html
* | | Merge pull request #33826 from tgturner/activejob-retry-attemptsEileen M. Uchitelle2018-09-091-1/+3
|\ \ \ | | | | | | | | retry_on argument `attempts` clarification
| * | | clarifies documentation around the attempts arugment to retry_onGraham Turner2018-09-091-1/+3
| |/ /
* / / Add missing `perform_enqueued_jobs` to error logging testyuuji.yaginuma2018-09-091-1/+1
|/ / | | | | | | Without `perform_enqueued_jobs`, job are not executed and assertion is not done.
* | Merge pull request #33751 from steves/add_retry_notifications_to_ajRafael França2018-08-304-35/+128
|\ \ | | | | | | Add hooks to ActiveJob around retries and discards
| * | Move ActiveJob retry and discard logging into log subscriberSteve S2018-08-303-32/+103
| | |
| * | Add hooks to ActiveJob around retries and discardsSteve S2018-08-292-7/+29
| | |
* | | Merge pull request #33718 from kddeisz/permit-listMatthew Draper2018-08-291-9/+11
|\ \ \ | | | | | | | | Finish converting whitelist and blacklist references
| * | | Permit list usage cleanup and clearer documentationKevin Deisz2018-08-271-6/+8
| | | |
| * | | Convert remaining usage of whitelist and blacklistKevin Deisz2018-08-241-5/+5
| |/ /
* / / Add test to make sure the custom object key can't be serializedRafael Mendonça França2018-08-281-2/+4
|/ /
* | Remove duplicate testutilum2018-08-221-2/+2
| | | | | | | | | | | | This patch corrects a duplicate method name introduced in #33635. Also fixes typo in method names.
* | DRY in `assert_enqueued_jobs`bogdanvlviv2018-08-201-2/+6
| |
* | Fix formatting of `ActiveJob::TestHelper` api docsbogdanvlviv2018-08-201-4/+4
| |
* | Allow `assert_performed_with` to be called without a block.bogdanvlviv2018-08-203-14/+129
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Example: ``` def test_assert_performed_with MyJob.perform_later(1,2,3) perform_enqueued_jobs assert_performed_with(job: MyJob, args: [1,2,3], queue: 'high') end ``` Follow up #33626.
* | Fix `assert_performed_jobs` and `assert_no_performed_jobs`bogdanvlviv2018-08-203-24/+289
| | | | | | | | | | Execution of `assert_performed_jobs`, and `assert_no_performed_jobs` without a block should respect passed `:except`, `:only`, and `:queue` options.
* | Add changelog entry about adding `:queue` option to job assertions and helpersbogdanvlviv2018-08-201-13/+4
| | | | | | | | | | Note that it removes changelog entry of #33265 since the entry in this commits includes that too.
* | Allow `:queue` option to `assert_no_performed_jobs`.bogdanvlviv2018-08-202-2/+65
| | | | | | | | | | | | | | | | | | | | | | | | | | | | If the `:queue` option is specified, then only the job(s) enqueued to a specific queue will not be performed. Example: ``` def test_assert_no_performed_jobs_with_queue_option assert_no_performed_jobs queue: :some_queue do HelloJob.set(queue: :other_queue).perform_later("jeremy") end end ```