Class: BatchByFilterScopeJob

Inherits:
ApplicationJob show all
Defined in:
app/jobs/batch_by_filter_scope_job.rb

Instance Method Summary collapse

Instance Method Details

#max_attemptsObject



8
9
10
# File 'app/jobs/batch_by_filter_scope_job.rb', line 8

def max_attempts
  1
end

#max_run_timeObject



4
5
6
# File 'app/jobs/batch_by_filter_scope_job.rb', line 4

def max_run_time
  1.hour
end

#perform(batch_response: nil, klass: nil, hash_query: nil, mode: nil, params: nil, project_id: nil, user_id: nil) ⇒ Object

At this point filter_query is already validated as good in terms of params, etc., see identifier.rb e.g.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
# File 'app/jobs/batch_by_filter_scope_job.rb', line 13

def perform(
  batch_response: nil, klass: nil, hash_query: nil, mode: nil, params: nil,
  project_id: nil, user_id: nil
)
  begin
    b = ::Queries::Query::Filter.instantiated_base_filter(hash_query)
    q = b.all(true)

    # Unused for now, but could be utilized for background job feedback at
    # some point.
    r = ::BatchResponse.new(
      preview: false,
      method: "#{klass} batch_by_filter_scope async"
    )

    klass.constantize.process_batch_by_filter_scope(
      batch_response: r,
      query: q,
      hash_query:,
      mode:,
      params:,
      project_id:,
      user_id:,
      called_from_async: true
    )

  rescue  => ex
    ExceptionNotifier.notify_exception(
      ex,
      data: { project_id:, filter_query:, mode:, params: }
    )
    raise
  end
end