TopicFile Sync with ActiveStorage
还没有人认领这个 Issue。
评估
调研方向
首先定位 TopicFileSync 和 TopicFile 模型,然后检查 ActiveStorage 设置以及现有的数据库迁移。根据 issue 中的字段定义 SyncProgress 模型和迁移,将进度更新与每个文件下载关联起来,并验证中断的同步可以恢复,同时记录已完成和失败的文件。
由索引模型根据 Issue 内容生成。
描述
Sync files and attach using ActiveStorage
class TopicFileSync
def sync(file_data, topic)
topic_file = TopicFile.find_or_initialize_by(external_id: file_data["id"])
# Skip if checksum unchanged (file hasn't changed on server)
return topic_file if topic_file.external_checksum == file_data["checksum"]
# Download and verify
downloaded_path = downloader.download(file_data["id"], expected_checksum: file_data["checksum"])
verifier.verify!(downloaded_path, file_data["checksum"])
# Attach via ActiveStorage
File.open(downloaded_path, "rb") do |io|
topic_file.file.attach(
io: io,
filename: file_data["filename"],
content_type: file_data["content_type"]
)
end
topic_file.update!(
topic: topic,
filename: file_data["filename"],
file_type: extract_file_type(file_data["content_type"]),
file_size: file_data["size_bytes"],
external_checksum: file_data["checksum"]
)
topic_file
ensure
FileUtils.rm_f(downloaded_path) if downloaded_path
end
end
Track and persist download progress for resume
- Create SyncProgress model:
create_table :sync_progress do |t|
t.string :manifest_version
t.string :status # pending, downloading, completed, failed
t.integer :total_files
t.integer :completed_files
t.integer :total_bytes
t.integer :downloaded_bytes
t.json :pending_file_ids # files remaining to download
t.json :failed_file_ids # files that failed
t.timestamps
end
- Update progress after each file download
- Use for resume after interruption/restart
- 主要语言
- HTML
- 星标
- 4
- 派生
- 0
- PR 合并指标
- 30 天内没有已合并 PR
环境准备
- 提供 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
rubyforgood/skillrx-beacon 的其他 Issue
-
cross-app sync
难度 3/5 1-2 天 新手友好度 35/100
-
Error handling未关闭cross-app sync
难度 4/5 3-5 天 新手友好度 35/100
-
cross-app sync
难度 5/5 一周以上 新手友好度 30/100
-
cross-app sync
难度 5/5 一周以上 新手友好度 25/100
-
cross-app sync
难度 3/5 1-2 天 新手友好度 45/100
查看 rubyforgood/skillrx-beacon 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
nexu-io/open-design#9262 · 1 条评论 ·
维护者通常 1 天内回复
-
[Bug]: streamed Responses API flex_unavailable error maps to 500 InternalServerError instead of 429未关闭llm translation
难度 2/5 1 小时以内 新手友好度 85/100
BerriAI/litellm#49736 · 1 条评论 ·
维护者通常 1 天内回复
-
[BUG] LLM conflict check ignores MNEMOSYNE_LLM_MAX_TOKENS, so reasoning models return empty replies未关闭
难度 2/5 1-3 小时 新手友好度 62/100
mnemosyne-oss/mnemosyne#1325 ·
维护者通常 1 天内回复
-
enhancement meshtastic-2.8
难度 2/5 1-3 小时 新手友好度 62/100
pskillen/meshflow-api#459 ·