Skip to content

Commit

Permalink
Do test still pass on this minimal pull
Browse files Browse the repository at this point in the history
  • Loading branch information
zz9pzza committed Jan 30, 2025
1 parent 1b156f9 commit 6a51d0c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 8 deletions.
5 changes: 5 additions & 0 deletions app/helpers/resque_executor_wrap_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module ResqueExecutorWrap
def around_perform_wrap_executor(*args)

Check warning on line 2 in app/helpers/resque_executor_wrap_helper.rb

View workflow job for this annotation

GitHub Actions / Rubocop

[rubocop] reported by reviewdog 🐶 Unused method argument - `args`. If it's necessary, use `_` or `_args` as an argument name to indicate that it won't be used. You can also write as `around_perform_wrap_executor(*)` if you want the method to accept any arguments but don't care about them. Raw Output: app/helpers/resque_executor_wrap_helper.rb:2:37: W: Lint/UnusedMethodArgument: Unused method argument - `args`. If it's necessary, use `_` or `_args` as an argument name to indicate that it won't be used. You can also write as `around_perform_wrap_executor(*)` if you want the method to accept any arguments but don't care about them.
Rails.application.executor.wrap { yield }

Check warning on line 3 in app/helpers/resque_executor_wrap_helper.rb

View workflow job for this annotation

GitHub Actions / Rubocop

[rubocop] reported by reviewdog 🐶 Consider using explicit block argument in the surrounding method's signature over `yield`. Raw Output: app/helpers/resque_executor_wrap_helper.rb:3:5: C: Style/ExplicitBlockArgument: Consider using explicit block argument in the surrounding method's signature over `yield`.
end
end
2 changes: 2 additions & 0 deletions app/models/bookmark.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ def check_new_external_work
after_create :update_work_stats
after_destroy :update_work_stats, :update_pseud_index

Resque::Job.extend(ResqueExecutorWrap)

def invalidate_bookmark_count
work = Work.where(id: self.bookmarkable_id)
if work.present? && self.bookmarkable_type == 'Work'
Expand Down
18 changes: 10 additions & 8 deletions app/models/concerns/async_with_resque.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@ def async(method, *args)

# Actually perform the delayed action.
def perform(method, *args)
if method.is_a?(Integer)
# TODO: For backwards compatibility, if the "method" is an integer, we
# treat it like an ID and use perform_on_instance instead. But once all
# of the jobs in the queue have been processed (or deleted), we should
# be able to remove this check.
perform_on_instance(method, *args)
else
send(method, *args)
Rails.application.executor.wrap do
if method.is_a?(Integer)
# TODO: For backwards compatibility, if the "method" is an integer, we
# treat it like an ID and use perform_on_instance instead. But once all
# of the jobs in the queue have been processed (or deleted), we should
# be able to remove this check.
perform_on_instance(method, *args)
else
send(method, *args)
end
end
end

Expand Down

0 comments on commit 6a51d0c

Please sign in to comment.