mirror of
https://github.com/we-promise/sure.git
synced 2026-04-16 02:24:08 +00:00
* Feat(CoinStats): Scaffold implementation, not yet functional * Feat(CoinStats): Implement crypto wallet balance and transactions * Feat(CoinStats): Add tests, Minor improvements * Feat(CoinStats): Utilize bulk fetch API endpoints * Feat(CoinStats): Migrate strings to i8n * Feat(CoinStats): Fix error handling in wallet link modal * Feat(CoinStats): Implement hourly provider sync job * Feat(CoinStats): Generate docstrings * Fix(CoinStats): Validate API Key on provider update * Fix(Providers): Safely handle race condition in merchance creation * Fix(CoinStats): Don't catch system signals in account processor * Fix(CoinStats): Preload before iterating accounts * Fix(CoinStats): Add no opener / referrer to API dashboard link * Fix(CoinStats): Use strict matching for symbols * Fix(CoinStats): Remove dead code in transactions importer * Fix(CoinStats): Avoid transaction fallback ID collisions * Fix(CoinStats): Improve Blockchains fetch error handling * Fix(CoinStats): Enforce NOT NULL constraint for API Key schema * Fix(CoinStats): Migrate sync status strings to i8n * Fix(CoinStats): Use class name rather than hardcoded string * Fix(CoinStats): Use account currency rather than hardcoded USD * Fix(CoinStats): Migrate from standalone to Provider class * Fix(CoinStats): Fix test failures due to string changes
28 lines
737 B
Ruby
28 lines
737 B
Ruby
class SyncHourlyJob < ApplicationJob
|
|
queue_as :scheduled
|
|
sidekiq_options lock: :until_executed, on_conflict: :log
|
|
|
|
# Provider item classes that opt-in to hourly syncing
|
|
HOURLY_SYNCABLES = [
|
|
CoinstatsItem # https://coinstats.app/api-docs/rate-limits#plan-limits
|
|
].freeze
|
|
|
|
def perform
|
|
Rails.logger.info("Starting hourly sync")
|
|
HOURLY_SYNCABLES.each do |syncable_class|
|
|
sync_items(syncable_class)
|
|
end
|
|
Rails.logger.info("Completed hourly sync")
|
|
end
|
|
|
|
private
|
|
|
|
def sync_items(syncable_class)
|
|
syncable_class.active.find_each do |item|
|
|
item.sync_later
|
|
rescue => e
|
|
Rails.logger.error("Failed to sync #{syncable_class.name} #{item.id}: #{e.message}")
|
|
end
|
|
end
|
|
end
|