Class: InstagramConnect::ProfileSyncJob
- Inherits:
-
ApplicationJob
- Object
- ActiveJob::Base
- ApplicationJob
- InstagramConnect::ProfileSyncJob
- Defined in:
- app/jobs/instagram_connect/profile_sync_job.rb
Overview
Fills in who people actually are.
The columns for this have existed since 0.1 and nothing ever wrote them, so an inbox showed a 17-digit Instagram-scoped id where a handle belongs and an account showed nothing at all. Meta returns profile data on a separate call from the message, so it has to be fetched deliberately.
Re-syncing is rate-limited by RESYNC_AFTER rather than by cleverness: a display name changes rarely, and every refetch spends budget that inbound message handling needs more.
Constant Summary collapse
- RESYNC_AFTER =
7.days
Instance Method Summary collapse
Instance Method Details
#perform(account_id: nil, conversation_id: nil) ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'app/jobs/instagram_connect/profile_sync_job.rb', line 17 def perform(account_id: nil, conversation_id: nil) if conversation_id sync_conversation(Conversation.find_by(id: conversation_id)) elsif account_id sync_account(Account.find_by(id: account_id)) else Account.active.find_each { |account| sync_account(account) } end end |