Sync Orchestrator

未关闭
#29 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
25/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
停滞
技术栈
rails, ruby
领域
backend, database

调研方向

从 issue 中展示的 SyncOrchestrator 和 ContentSyncJob 入口点开始,然后跟踪现有的 manifest、provider、topic 和文件同步实现。在进行更改之前,先定义调度、网络检查、并发运行锁定、事务回滚以及 manifest 更改应如何运行。完成的标准是拥有一个安全的自动同步流程,并覆盖失败、重试和并发运行场景。

由索引模型根据 Issue 内容生成。

描述

cross-app sync

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
主要语言
HTML
星标
4
派生
0
PR 合并指标
30 天内没有已合并 PR

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

rubyforgood/skillrx-beacon 的其他 Issue

查看 rubyforgood/skillrx-beacon 的全部 Issue

相似的 Issue

更多 Backend & API Design Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。