aboutsummaryrefslogtreecommitdiffstats
path: root/activejob
Commit message (Collapse)AuthorAgeFilesLines
* Start Rails 6.1 developmentRafael Mendonça França2019-04-242-140/+3
|
* Use ActiveJob 5.2 retry logic for old jobsJohn Hawthorn2019-04-222-5/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | Rails 6 introduces retries per-exception, instead of a global count of retries. Because ActiveJob 5.2 doesn't serialize the execution count per-exception, when ActiveJob 6.0 picks up an "old" job it can't know the exception count in the new format. This can also be an issue if AJ 6.0 serializes a new job with exception_executions which is later picked up by AJ 5.2, which would clear exception_executions (since it has no knowledge of it). Previously we handled this by resetting exception_executions, if it wasn't defined on a job, which could result in the worst case retrying the job 2x the times we should. This commit changes how we handle loading a legacy job: instead of resetting exception_executions, we instead will always use the global executions count. This way, jobs which only have one retry_on (and didn't have a behaviour change in AJ 6) are backwards-and-forwards-compatible with counts respected exactly. Jobs with multiple retry_on will revert to the AJ5.2 behaviour if they were ever run under AJ5.2.
* Merge pull request #35738 from gmcgibbon/aj_assert_drop_usec_docsGannon McGibbon2019-04-201-9/+9
|\ | | | | ActiveJob time argument assertion documentation
| * Fix assert_performed_with time testsGannon McGibbon2019-03-251-9/+9
| |
* | Use individual execution counters when calculating retry delayPatrik Bóna2019-04-123-2/+26
| | | | | | | | | | | | Individual execution counters were introduced in #34352. However `#determine_delay` which is used to calculate retry delay still uses the global counter. This commit fixes it.
* | Merge pull request #35873 from prathamesh-sonpatki/enqueuing-fixesEileen M. Uchitelle2019-04-051-1/+1
|\ \ | | | | | | Fix the deprecation warning about `config.active_job.return_false_on_aborted_enqueue`
| * | Fix the deprecation warning about ↵Prathamesh Sonpatki2019-04-051-1/+1
| | | | | | | | | | | | | | | | | | | | | `config.active_job.return_false_on_aborted_enqueue` - It will return false in Rails 6.1 not 6.0. Also fixed the default value which is true for new applications.
* | | Add Active Job release notes [ci skip] (#35872)प्रथमेश Sonpatki2019-04-051-2/+2
|/ /
* | Output junit format test reportFumiaki MATSUSHIMA2019-04-041-0/+2
| |
* | Follow up tweaks b89a3e7e638a50c648a17d09c48b49b707e1d90d [ci skip]Ryuta Kamizono2019-03-311-1/+1
|/ | | | | | * use backticks instead of `+` * and more (e.g. missed replacing `Array#excluding` and `Enumerable#excluding` in b89a3e7e638a50c648a17d09c48b49b707e1d90d)
* Drop microseconds in job argument assertionsGannon McGibbon2019-03-223-0/+73
|
* Merge tag 'v6.0.0.beta3'eileencodes2019-03-132-1/+6
|\ | | | | | | v6.0.0.beta3 release
| * Prep releaseeileencodes2019-03-112-1/+6
| | | | | | | | | | | | | | * Update RAILS_VERSION * Bundle * rake update_versions * rake changelog:header
* | Merge pull request #35559 from ↵Kasper Timm Hansen2019-03-091-1/+2
|\ \ | | | | | | | | | | | | ashishprajapati/ashishprajapati/important_textual_improvements Added missing guide links in documentation and minor wording fix
| * | Added missing guide links in README documentation and minor wording fix [ci ↵ashishprajapati2019-03-101-1/+2
| |/ | | | | | | skip]
* | Fix links in gemspec and docs from http to https.Abhay Nikam2019-03-092-4/+4
| |
* | Updated links from http to https in guides, docs, etcAbhay Nikam2019-03-091-3/+3
|/
* Preparing for 6.0.0.beta2 releaseRafael Mendonça França2019-02-252-1/+6
|
* [ci skip] activejob typo fix.alkesh262019-02-251-1/+1
|
* Adding enque time tracking and loggingCory Gwin @gwincr112019-02-134-2/+20
| | | | | | | | | | | | | | | Motivation: - Currently we have 2 seperate monkey patches in place for tracking enqueded time for 2 seperate workers. It seems that activejob could be a source of truth for how long an item has been enqued so that we can easily use it for consistent monitoring across workers/apps to ensure that jobs are running at an acceptable speed. Changes: - Add an enqueded at attribute and serilization tooling. - Add a method to get how long a job has been enqueded for. - Add a logging item to show how long a job was enqued prior to the perform method firing.
* Document queue_as block arguments and their useOlivier Lacan2019-02-111-0/+20
| | | | | | | | | | Currently, we only document the use case for ActiveJob's `queue_as` block arguments in [Rails Guides][1]. It seems necessary to document them in the API docs as well considering how useful and powerful this option is. [1]: https://edgeguides.rubyonrails.org/active_job_basics.html#queues [ci skip]
* Respect ENV variables when finding DBs etc for the test suiteMatthew Draper2019-02-063-2/+3
| | | | | If they're not set we'll still fall back to localhost, but this makes it possible to run the tests against a remote Postgres / Redis / whatever.
* activejob typo fixes.alkesh262019-01-292-2/+2
|
* Preparing for 6.0.0.beta1 releaseRafael Mendonça França2019-01-182-1/+3
|
* Revert "Revert "Merge pull request #34387 from ↵Kasper Timm Hansen2019-01-081-0/+3
| | | | | | | | yhirano55/rails_info_properties_json"" I reverted the wrong commit. Damn it. This reverts commit f66a977fc7ae30d2a07124ad91924c4ee638a703.
* Revert "Merge pull request #34387 from yhirano55/rails_info_properties_json"Kasper Timm Hansen2019-01-081-3/+0
| | | | | | | | | | | We had a discussion on the Core team and we don't want to expose this information as a JSON endpoint and not by default. It doesn't make sense to expose this JSON locally and this controller is only accessible in dev, so the proposed access from a production app seems off. This reverts commit 8eaffe7e89719ac62ff29c2e4208cfbeb1cd1c38, reversing changes made to b6e4305c3bca4c673996d0af9db0f4cfbf50215e.
* Ensure 0 is always the default for the individual exception counters in ↵Rosa Gutierrez2019-01-082-3/+3
| | | | | | | | | | | ActiveJob Some adapters like Resque that use Redis, convert the Ruby hash with a default value, Hash.new(0), into a regular hash without a default value after serializing, storing and deserializing. This raises an error when we try to access a missing exception key. A simple solution is not to rely on the hash's default value, and provide a default as alternative when accessing it instead.
* Rewrite ActiveJob exception tests so it runs with the real adaptersRosa Gutierrez2019-01-082-88/+85
| | | | | | | | | Previously, by extending ActiveJob::TestCase, the test adapter provided for tests was being used always, in all executions where supposedly different adapters were being used. As a consequence, some bugs visible only for some adapters might have gone undetected. This commit changes that, skipping queue adapters for which we can't test scheduling jobs with a delay.
* Support in-flight jobs stored before individual execution counters for ↵Rosa Gutierrez2019-01-053-21/+39
| | | | | | | | | | | | | | | | | | | | `retry_on` (#34731) Also, make tests and examples for individual execution counters clearer, as it wasn't entierly clear what would happen in this case: ``` retry_on CustomException, OtherException, attempts: 3 ``` The job would be retried at most 3 times in total, for both CustomException and OtherException. To have the job retry 3 times at most for each exception individually, the following retry_on declarations are necessary: ``` retry_on CustomException, attempts: 3 retry_on OtherException, attempts: 3 ```
* Bump license years for 2019Arun Agrawal2018-12-312-2/+2
|
* Enable `Style/RedundantBegin` cop to avoid newly adding redundant begin blockRyuta Kamizono2018-12-217-72/+50
| | | | | | | | | | Currently we sometimes find a redundant begin block in code review (e.g. https://github.com/rails/rails/pull/33604#discussion_r209784205). I'd like to enable `Style/RedundantBegin` cop to avoid that, since rescue/else/ensure are allowed inside do/end blocks in Ruby 2.5 (https://bugs.ruby-lang.org/issues/12906), so we'd probably meets with that situation than before.
* Use native `Array#append`, `Array#prepend`, `Hash#transform_keys`, and ↵Ryuta Kamizono2018-12-201-1/+0
| | | | | | | | | | `Hash#transform_keys!` Since Rails 6 requires Ruby 2.5. https://github.com/ruby/ruby/blob/ruby_2_5/NEWS Follow up #34754.
* Require Ruby 2.5 for Rails 6.Kasper Timm Hansen2018-12-192-3/+3
| | | | | | | | | | Generally followed the pattern for https://github.com/rails/rails/pull/32034 * Removes needless CI configs for 2.4 * Targets 2.5 in rubocop * Updates existing CHANGELOG entries for fewer merge conflicts * Removes Hash#slice extension as that's inlined on Ruby 2.5. * Removes the need for send on define_method in MethodCallAssertions.
* Do not require `webpacker` in Active Job integration testsyuuji.yaginuma2018-12-081-0/+1
| | | | | | Because `skip-javascript` option is specified for the dummy application used in the integration tests. https://github.com/rails/rails/blob/bdc96802a7a4a8c6d183272e997430e8b9006498/activejob/test/support/integration/helper.rb#L14
* Improve deprecation message for enqueue returning falseRafael Mendonça França2018-12-052-1/+16
| | | | | | And make sure new applications in Rails 6.0 has this config enabled. Also, improve test coverage and add a CHANGELOG entry.
* Merge pull request #33992 from kirs/enqueue-return-falseRafael França2018-12-054-1/+53
|\ | | | | Make AJ::Base#enqueue return false if the job wasn't enqueued
| * Make AJ::Base#enqueue return false if the job wasn't enqueuedKir Shatrov2018-10-284-1/+53
| |
* | Do not deserialize GlobalID objects that were not generated by Active JobRafael Mendonça França2018-11-272-1/+5
| | | | | | | | | | | | | | Trusting any GlobaID object when deserializing jobs can allow attackers to access information that should not be accessible to them. Fix CVE-2018-16476.
* | Merge pull request #34376 from composerinteralia/default_queue_nameRafael França2018-11-232-2/+29
|\ \ | | | | | | Allow using queue prefix with a default queue name
| * | Allow using queue prefix with a default queue nameDaniel Colson2018-11-032-2/+29
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #34366 Currently setting queue_name_prefix will not combine a prefix with the default_queue_name; it will only affect queue names set with `queue_as`. With this PR the prefix will affect the default_queue_name as well. Closes #19831 Currently setting default_queue_name doesn't actually affect the queue_name default (although default_queue_name does get used if you pass a falsey `part_name` to `queue_as`). This PR would get default_queue_name working as expected as well. Because the queue_name default is now a lambda wrapping the default_queue_name, rather than the default_queue_name itself, I had to update one test to use the instance method `#queue_name` (which `instance_exec`s the value) instead of the class method. I think this change is OK, since only the instance method is documented. There was a question about whether we want a `default_queue_name` configuration. If we want to get rid of it, I would also be happy to open a PR for that instead. It has been around for a while now, but it also hasn't really worked for a while now. r? @matthewd since you had an opinion about this before
* | | Keep executions for each specific exception (#34352)Alberto Almagro2018-11-235-4/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Keep executions for each specific declaration Fixes #34337 ActiveJob used the global executions counter to control the number of times a job should be retried. The problem with this approach was that in case a job raised different exceptions during its executions they weren't retried the number of times defined by their `attemps` number. **Example:** Having the following job: ```ruby class BuggyJob < ActiveJob::Base retry_on CustomException, attemps: 3 retry_on OtherException, attempts: 3 end ``` If the job raised `CustomException` in the first two executions and then it raised `OtherException`, the job wasn't retried anymore because the global executions counter was already indicating 3 attempts. With this patch each `retry_on` declaration has its specific counter so that the first two executions that raise `CustomException` don't affect the retries count that future exceptions may have. * Revert "clarifies documentation around the attempts arugment to retry_on" This reverts commit 86aa8f8c5631f77ed9a208e5107003c01512133e.
* | | Allow all ActiveJob assertion helper to accept Proc in their `only` kw:Edouard CHIN2018-11-214-4/+101
| | | | | | | | | | | | | | | | | | | | | | | | - That feature is useful to enqueue or assert that jobs got enqueued or performed based on dynamic conditions. We will be able to leverage that feature to fix all ActionMailer assertion helper issue when a Mailer define a custom delivery job (see next commit).
* | | Permit ActionController::Parameters for serializable HashBernie Chiu2018-11-193-3/+34
| | |
* | | Change queueing to queuing in docs and comments [skip ci]jacobherrington2018-11-187-13/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | My spellchecker flagged this as an incorrect spelling, upon further research it appears to be a point of contention in English. Either way might work. After further examination queuing is much more common in the Rails codebase so making this change will serve to standardize the spelling.
* | | Make `PERMITTED_TYPES` privateAlberto Almagro2018-11-121-4/+3
| | | | | | | | | | | | | | | | | | | | | | | | The constant `PERMITTED_TYPES` is only used by the private method `serialize_argument` and it already has the `# :nodoc:` annotation as the other constants in the class. Complements e899e22
* | | Document missing supported types [ci skip]Alberto Almagro2018-11-112-7/+12
| | | | | | | | | | | | | | | This commit adds missing types to the supported types list, which was extended in #30941
* | | Restore `private_constant` which is lost accidentally in #30941Ryuta Kamizono2018-11-091-1/+1
| | | | | | | | | | | | https://github.com/rails/rails/pull/30941/files#diff-fc90ec41ef75be8b2259526fe1a8b663L53
* | | 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.