aboutsummaryrefslogtreecommitdiffstats
path: root/activejob/lib
Commit message (Collapse)AuthorAgeFilesLines
* Fix example code in ActiveJob::Core [ci skip]Yoshiyuki Hirano2017-12-051-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 1) It seems that it raise error on example code in `ActiveJob::Core`. Before: ```ruby class DeliverWebhookJob < ActiveJob::Base def serialize super.merge('attempt_number' => (@attempt_number || 0) + 1) end def deserialize(job_data) super @attempt_number = job_data['attempt_number'] end rescue_from(Timeout::Error) do |exception| raise exception if @attempt_number > 5 retry_job(wait: 10) end def perform raise Timeout::Error end end ``` Then it run `DeliverWebhookJob.perform_now` in `rails console`. And raise error: NoMethodError: undefined method `>' for nil:NilClass from /app/jobs/deliver_webhook_job.rb:12:in `block in <class:DeliverWebhookJob>' So I thought it's necessary to fix it. After: ```ruby class DeliverWebhookJob < ActiveJob::Base attr_writer :attempt_number def attempt_number @attempt_number ||= 0 end def serialize super.merge('attempt_number' => attempt_number + 1) end def deserialize(job_data) super self.attempt_number = job_data['attempt_number'] end rescue_from(Timeout::Error) do |exception| raise exception if attempt_number > 5 retry_job(wait: 10) end def perform raise Timeout::Error end end ``` Then it run `DeliverWebhookJob.perform_now` in `rails console`. And it does'nt raise error NoMethodError. 2) Use `Timeout::Error` instead of `TimeoutError` (`TimeoutError` is deprecated).
* Preparing for 5.2.0.beta2 releaseRafael Mendonça França2017-11-281-1/+1
|
* Preparing for 5.2.0.beta1 releaseRafael Mendonça França2017-11-271-1/+1
|
* Improve DelayedJob wrapper loggingJacek Lachowski2017-11-241-0/+4
| | | | | | | | ActiveJob wraps every adapter into its own class, that is later passed into DelayedJob which is responsible for displaying all the logs. This change improves the logging so we can easily trace executed jobs and see meaningful information in the logs.
* Use .tt extension to all the template filesRafael Mendonça França2017-11-132-0/+0
| | | | | | | | Make clear that the files are not to be run for interpreters. Fixes #23847. Fixes #30690. Closes #23878.
* [Active Job] require_relative => requireAkira Matsuda2017-10-214-13/+13
| | | | This basically reverts fef234f1f0a238c2277459652861144ae89501ff
* Yield with an error instance instead of error classKazunori Kajihiro2017-09-291-1/+1
|
* Update activejob doc [ci skip]Yoshiyuki Hirano2017-08-301-1/+1
|
* Use ssl in guide and comment [ci skip]Yoshiyuki Hirano2017-08-191-1/+1
|
* Use `ArgumentError` instead of own error classyuuji.yaginuma2017-07-201-2/+1
| | | | | If the argument is invalid, I think that it is more intuitive to use `ArgumentError` than its own error class.
* Fix `warning: circular argument reference`yuuji.yaginuma2017-07-191-2/+2
| | | | | | | | | This fixes the following warnings: ``` rails/activejob/lib/active_job/test_helper.rb:119: warning: circular argument reference - except rails/activejob/lib/active_job/test_helper.rb:166: warning: circular argument reference - except ```
* Add `except` option for ActiveJob::TestHelper methodsposthumanism2017-07-182-15/+81
|
* [Active Job] `rubocop -a --only Layout/EmptyLineAfterMagicComment`Koichi ITO2017-07-1133-0/+33
|
* Use frozen-string-literal in ActiveJobKir Shatrov2017-07-0933-0/+33
|
* [Active Job] require => require_relativeAkira Matsuda2017-07-014-13/+13
|
* ActiveJob::Core#serialize stores provider_job_id (fixes #26581).utilum2017-06-271-0/+1
|
* Use mattr_accessor default: option throughout the projectGenadi Samokovarov2017-06-033-4/+4
|
* Add option for class_attribute default (#29270)David Heinemeier Hansson2017-05-292-8/+3
| | | | | | | | | | | | * Allow a default value to be declared for class_attribute * Convert to using class_attribute default rather than explicit setter * Removed instance_accessor option by mistake * False is a valid default value * Documentation
* Removed string inquiry.Mohit Natoo2017-05-261-4/+4
| | | | | | fixed indentation. rebased with master.
* Provides friendlier way to access queue adapters of a job.Mohit Natoo2017-05-261-3/+16
| | | | - removed predicate method. Used only reader.
* Define path with __dir__bogdanvlviv2017-05-231-1/+1
| | | | | | ".. with __dir__ we can restore order in the Universe." - by @fxn Related to 5b8738c2df003a96f0e490c43559747618d10f5f
* Improving docs for callbacks execution order [ci skip]dixpac2017-05-211-1/+3
| | | | | When define callbacks latest definition on the same callback/method overwrites previous ones.
* Add error logging to Active JobSteven Bull2017-03-271-3/+10
| | | | | | | | | | | | | | | | | | | | Active Job logging instrumentation is changed to log errors (with backtrace) when a job raises an exception in #perform. This improves debugging during development and test with the default configuration. Prior to Rails 5, the default development configuration ran jobs with InlineAdapter, which would raise exceptions to the caller and be shown in the development log. In Rails 5, the default adapter was changed to AsyncAdapter, which would silently swallow exceptions and log a "Performed SomeJob from Async..." info message. This could be confusing to a developer, as it would seem that the job was performed successfully. This patch removes the "Performed..." info message from the log and adds an error-level "Error performing SomeJob..." log message which includes the exception backtrace for jobs that raise an exception within the #perform method. It provides this behavior for all adapters.
* Start Rails 5.2 developmentMatthew Draper2017-03-221-2/+2
|
* Revert #27850 following test breakage (#28427)David Heinemeier Hansson2017-03-151-4/+7
|
* Merge pull request #28112 from bolek/include-job_id-in-all-active-job-logsRafael França2017-02-231-2/+2
|\ | | | | Include JobID in all ActiveJob info logs
| * Include JobID in all ActiveJob info logsBolek Kurowski2017-02-221-2/+2
| | | | | | | | | | | | | | | | | | | | Currently we provide the Job ID in logs only related to enqueuing a job. This adds the job id to the remaining ActiveJob logs when: - a job started performing - a job ended performing Providing the job id in those logs will ease searching logs by job id.
* | Preparing for 5.1.0.beta1 releaseRafael Mendonça França2017-02-231-1/+1
|/
* correctly set test adapter when configure the queue adapter on a per job ↵Yuji Yaginuma2017-01-311-10/+35
| | | | | | | | | | | | (#26690) The `ActiveJob::TestHelper` replace the adapter to test adapter in `before_setup`. It gets the target class using the `descendants`, but if the test target job class is not loaded, will not be a replacement of the adapter. Therefore, instead of replacing with `before_setup`, modified to replace when setting adapter. Fixes #26360
* Append skipped jobs to enqueued_jobsAlexander Pauly2017-01-311-7/+3
| | | | | | | | | | Refactored ActiveJob TestAdapter Updated ActiveJob changelog Fixed typo in changelog Fixed formatting issue in changelog
* Merge pull request #27624 from elfassy/assert_enqueued_jobs_with_queue_levelGuillermo Iguaran2017-01-191-10/+24
|\ | | | | Specify the queue to be used with assert_enqueued_jobs
| * assert_enqueued_jobs with queue optionMichael Elfassy2017-01-181-10/+24
| |
* | s/perfomed/performed/Akira Matsuda2017-01-171-1/+1
| | | | | | | | [ci skip]
* | remove unused requireyuuji.yaginuma2017-01-151-1/+0
|/ | | | `InlineAdapter` is not used from 1f8558f.
* `self.` is not needed when calling its own instance methodAkira Matsuda2017-01-051-1/+1
| | | | Actually, private methods cannot be called with `self.`, so it's not just redundant, it's a bad habit in Ruby
* Revert "Merge pull request #27550 from ↵Rafael Mendonça França2017-01-031-1/+1
| | | | | | | | | mtsmfm/fix-generator-command-for-nested-rails-engine" This reverts commit 1e969bfb98b88799e2c759fce25a1d8cf00d7ce7, reversing changes made to a5041f267ded119c2d00b8786c2f2c1e3f93c8a1. Reason: It breaks the public API
* Fix generator command for nested (namespaced) rails engineFumiaki MATSUSHIMA2017-01-031-1/+1
| | | | | | | | | | | | | If we create nested (namespaced) rails engine such like bukkits-admin, `bin/rails g scaffold User name:string age:integer` will create `bukkits-admin/app/controllers/bukkits/users_controller.rb` but it should create `bukkits-admin/app/controllers/bukkits/admin/users_controller.rb`. In #6643, we changed `namespaced_path` as root path because we supposed application_controller is always in root but nested rails engine's application_controller will not.
* Bump license years for 2017Jon Moss2016-12-311-1/+1
| | | | | | | | Per https://www.timeanddate.com/counters/firstnewyear.html, it's already 2017 in a lot of places, so we should bump the Rails license years to 2017. [ci skip]
* Privatize unneededly protected method in Active JobAkira Matsuda2016-12-241-2/+2
|
* No need to nodoc private methodsAkira Matsuda2016-12-241-5/+5
|
* remove Ruby warning from Active Job test helper methodsyuuji.yaginuma2016-11-181-4/+4
| | | | | | | | | This removes the following warnings. ``` /home/travis/build/rails/rails/activejob/lib/active_job/test_helper.rb:241: warning: shadowing outer local variable - job /home/travis/build/rails/rails/activejob/lib/active_job/test_helper.rb:265: warning: shadowing outer local variable - job ```
* Use named parameters instead of `assert_valid_keys`Maxime Boisvert2016-11-161-8/+8
|
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-298-8/+8
|
* removes requires already present in active_support/railsXavier Noria2016-10-271-1/+0
|
* Add examples of queue_adapter and perform_enqueued jobs to API Docs.Gabi Stefanini2016-10-211-0/+24
|
* add missing closing tag [ci skip]yuuji.yaginuma2016-10-141-1/+1
|
* Removed deprecated support to passing the adapter class to .queue_adapterRafael Mendonça França2016-10-101-10/+0
|
* Removed deprecated #original_exception in ActiveJob::DeserializationErrorRafael Mendonça França2016-10-101-13/+1
|
* Fixnum and Bignum are deprecated in Ruby trunkMatthew Draper2016-10-081-2/+2
| | | | https://bugs.ruby-lang.org/issues/12739
* fix link to `resque` [ci skip]yuuji.yaginuma2016-09-201-1/+1
| | | | | `1-x-stable` branch does not exist, `master` is 1.x branch. Ref: http://words.steveklabnik.com/rescuing-resque-again