| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
Since #25037, `queue_adapter=` simply delegates to `interpret_adapter`
only.
|
|
|
|
|
| |
* I think it's better to have a leading space after the `#`
denoting the start of the comment.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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).
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
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.
|
|
|
|
| |
This basically reverts fef234f1f0a238c2277459652861144ae89501ff
|
| |
|
| |
|
| |
|
|
|
|
|
| |
If the argument is invalid, I think that it is more intuitive to use
`ArgumentError` than its own error class.
|
|
|
|
|
|
|
|
|
| |
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
```
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
* 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
|
|
|
|
|
|
| |
fixed indentation.
rebased with master.
|
|
|
|
| |
- removed predicate method. Used only reader.
|
|
|
|
|
| |
When define callbacks latest definition on the same callback/method
overwrites previous ones.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
| |
|
| |
|
|\
| |
| | |
Include JobID in all ActiveJob info logs
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
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.
|
|/ |
|
|
|
|
|
|
|
|
|
|
|
|
| |
(#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
|
|
|
|
|
|
|
|
|
|
| |
Refactored ActiveJob TestAdapter
Updated ActiveJob changelog
Fixed typo in changelog
Fixed formatting issue in changelog
|
|\
| |
| | |
Specify the queue to be used with assert_enqueued_jobs
|
| | |
|
| |
| |
| |
| | |
[ci skip]
|
|/
|
|
| |
`InlineAdapter` is not used from 1f8558f.
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
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
```
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
| |
https://bugs.ruby-lang.org/issues/12739
|
|
|
|
|
| |
`1-x-stable` branch does not exist, `master` is 1.x branch.
Ref: http://words.steveklabnik.com/rescuing-resque-again
|
|
|
|
|
|
| |
`subclasses` get only child classes.
Therefore, if create a job common parent class as `ApplicationJob`,
inherited class does not get properly.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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.
|
|\
| |
| |
| | |
Add @queue variable to JobWrapper
|