iachat/app/jobs/channels/whatsapp/baileys_connection_check_scheduler_job.rb
Gabriel Jablonski 2cf1795a3b
feat: baileys connection period check (#87)
* feat: periodic check for baileys connection

* chore: add index on provider connection
2025-07-26 11:38:16 -03:00

12 lines
374 B
Ruby

class Channels::Whatsapp::BaileysConnectionCheckSchedulerJob < ApplicationJob
queue_as :low
def perform
Channel::Whatsapp.where(provider: 'baileys')
.where("provider_connection->>'connection' = ?", 'open')
.find_each do |channel|
Channels::Whatsapp::BaileysConnectionCheckJob.perform_later(channel)
end
end
end