Consider atomic JSON writes
还没有人认领这个 Issue。
评估
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 新手友好度
- 70/100
调研方向
找到写入 Thing 设置的代码,并查看它目前如何序列化和保存 JSON 文件。然后检查项目中现有的设置持久化测试,并补充对写入中断或原子写入的测试覆盖。完成标准是:更新设置时使用临时文件并进行替换,以便写入中断时设置文件仍然有效。
由索引模型根据 Issue 内容生成。
描述
Describe the bug
If LabThings is interrupted while writing Thing settings, the file could get corrupted.
To Reproduce
Pull the power during a settings update.
Expected behaviour
It would be nice if the file didn't get corrupted.
Additional context
This should be easy enough to avoid by writing to a temp file, then swapping the temp file with the actual settings file. That reduces to nearly-zero the time during which the file could be broken.
- 主要语言
- Python
- 星标
- 10
- 派生
- 3
- 平均合并
- 5 天 17 小时
- 30 天内合并 PR
- 1
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
labthings/labthings-fastapi 的其他 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
labthings/labthings-fastapi#405 · 1 条评论 ·
-
drop-python-version
难度 2/5 1-3 小时 新手友好度 68/100
labthings/labthings-fastapi#354 · 2 条评论 ·
-
难度 2/5 1-3 小时 新手友好度 64/100
labthings/labthings-fastapi#312 · 1 条评论 ·
-
enhancement
难度 3/5 1-2 天 新手友好度 65/100
labthings/labthings-fastapi#407 ·
-
难度 5/5 一周以上 新手友好度 35/100
labthings/labthings-fastapi#404 · 2 条评论 ·
查看 labthings/labthings-fastapi 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 86/100
-
Validate finite output clamping limits in StepPredictor.prepare_clamping_params to prevent silent NaN/Inf propagation可能已有人在做 @muskan-creates352 今天认领。 未关闭
难度 2/5 1-3 小时 新手友好度 84/100
mllam/neural-lam#848 ·
维护者通常 2 天内回复
-
infra
难度 1/5 1 小时以内 新手友好度 88/100
fab-geocommuns/RNB-coeur#1166 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 78/100
deepspeedai/DeepSpeed#8951 ·
维护者通常 2 天内回复
-
难度 2/5 1-3 小时 新手友好度 76/100
aws/context-ontology-accelerator#343 ·
维护者通常 1 天内回复