Files
leadchat/app/jobs/conversations/resolution_job.rb
Sojan Jose 5cbfcfbfa0 chore: Limit conversation resolution Job (#6433)
We will be adding a limit to the resolution job so that it is performed at a spaced interval. This will ensure there won't be a sudden spike in resource usage

fixes: chatwoot/product#707
2023-02-13 14:00:52 +05:30

10 lines
373 B
Ruby

class Conversations::ResolutionJob < ApplicationJob
queue_as :low
def perform(account:)
# limiting the number of conversations to be resolved to avoid any performance issues
resolvable_conversations = account.conversations.resolvable(account.auto_resolve_duration).limit(Limits::BULK_ACTIONS_LIMIT)
resolvable_conversations.each(&:toggle_status)
end
end