Skip to content

Commit

Permalink
Wrap enumerators to avoid JobIteration deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
etiennebarrie committed Dec 16, 2024
1 parent 925a013 commit 22ef7cb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/jobs/concerns/maintenance_tasks/task_job_concern.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def retry_on(*, **)
def build_enumerator(_run, cursor:)
cursor ||= @run.cursor
self.cursor_position = cursor
enumerator_builder = self.enumerator_builder
@collection_enum = @task.enumerator_builder(cursor: cursor)

@collection_enum ||= case (collection = @task.collection)
Expand Down Expand Up @@ -75,6 +76,9 @@ def build_enumerator(_run, cursor:)
MSG
end

unless @collection_enum.is_a?(JobIteration.enumerator_builder::Wrapper)
@collection_enum = enumerator_builder.wrap(enumerator_builder, @collection_enum)
end
throttle_enumerator(@collection_enum)
end

Expand Down

0 comments on commit 22ef7cb

Please sign in to comment.