rubyforgood / rubyforgood/skillrx-beacon

Sync Orchestrator

Open
#29 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

cross-app sync
Dominant language
HTML
Stars
4
Forks
0
PR merge metrics
No merged PRs in 30d

Description

Coordinate full sync flow with transaction safety

  class SyncOrchestrator
    def perform
      report_status(:syncing)

      manifest = fetch_manifest

      ActiveRecord::Base.transaction do
        sync_tags(manifest["tags"])
        sync_providers_with_content(manifest["providers"])
        cleanup_orphans(manifest)
        update_device_config(manifest)
      end

      report_status(:synced)
    rescue ManifestChangedError    <----- this may be redundant
      # Manifest changed during sync, restart
      retry
    rescue => e
      report_status(:error, error_message: e.message)
      raise
    end

    private

    def sync_providers_with_content(providers)
      providers.each_with_index do |provider_data, idx|
        provider = provider_sync.sync(provider_data)

        provider_data["topics"].each do |topic_data|
          # Check manifest hasn't changed every 5 files
          check_manifest_unchanged! if should_check_manifest?(idx)

          topic = topic_sync.sync(topic_data, provider)

          topic_data["files"].each do |file_data|
            topic_file_sync.sync(file_data, topic)
          end
        end
      end
    end
  end

Run sync process automatically

  class ContentSyncJob < ApplicationJob
    queue_as :default

    def perform
      return unless network_available?
      return if sync_in_progress?

      SyncOrchestrator.new.perform
    end
  end
  • Schedule periodic checks (e.g., hourly via cron or whenever gem)
  • Detect network connectivity before attempting
  • Prevent concurrent sync attempts with advisory lock

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the SyncOrchestrator and ContentSyncJob entry points shown in the issue, then trace the existing manifest, provider, topic, and file sync implementations. Define how scheduling, network checks, concurrency locking, transaction rollback, and manifest changes should behave before making changes. Done means a safe automated sync flow with coverage for failure, retry, and concurrent-run cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
rails, ruby
Domain
backend, database
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.