Class: TbRedirects::DetectRedirectLoopJob
- Inherits:
-
ActiveJob::Base
- Object
- ActiveJob::Base
- TbRedirects::DetectRedirectLoopJob
- Defined in:
- app/jobs/tb_redirects/detect_redirect_loop_job.rb
Defined Under Namespace
Classes: AttemptsExceeded
Constant Summary collapse
- MAX_ATTEMPTS =
100
Instance Attribute Summary collapse
-
#attempts ⇒ Object
readonly
Returns the value of attribute attempts.
Instance Method Summary collapse
-
#initialize(*arguments) ⇒ DetectRedirectLoopJob
constructor
A new instance of DetectRedirectLoopJob.
- #perform(redirect) ⇒ Object
Constructor Details
#initialize(*arguments) ⇒ DetectRedirectLoopJob
Returns a new instance of DetectRedirectLoopJob.
7 8 9 10 |
# File 'app/jobs/tb_redirects/detect_redirect_loop_job.rb', line 7 def initialize(*arguments) super(*arguments) @attempts = 0 end |
Instance Attribute Details
#attempts ⇒ Object (readonly)
Returns the value of attribute attempts.
4 5 6 |
# File 'app/jobs/tb_redirects/detect_redirect_loop_job.rb', line 4 def attempts @attempts end |
Instance Method Details
#perform(redirect) ⇒ Object
12 13 14 15 |
# File 'app/jobs/tb_redirects/detect_redirect_loop_job.rb', line 12 def perform(redirect) parents = TbRedirect.where(destination: redirect.source) parents.each { |p| search_parent(p, redirect.destination) } end |