Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Make finish-reset swap repos without a gap

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

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
半天
新手友好度
45/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
活跃
技术栈
csharp
领域
backend

调研方向

Start in FinishReset, where DeleteRepoIfExists runs before tempRepo.MoveTo(PrefixRepoFilePath(code)). Check how _____temp_____ and the live repo path are built, and how cancellation is checked between the steps. Done means the live repo is moved aside before the new one is moved in, the old copy is deleted only as best effort, and the cancellation behaviour during the swap is settled. Confirm the change with a test that makes the delete fail partway. The issue does not settle the cancellation question, so ask the maintainers before choosing.

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

描述

FinishReset replaces the live repo in two steps:

await DeleteRepoIfExists(code, cancellationToken);   // recursive delete of the live repo
tempRepo.MoveTo(PrefixRepoFilePath(code));           // then move the new one in

Consequences:

  • Brief window: between the two calls the repo doesn't exist, so concurrent hgweb/resumable requests for that code get a 404 or a partially deleted repo. A recursive delete of a large repo on NFS can take a while.
  • Possible permanent loss: if the delete throws partway through, for example because a file is held open, the request fails with a partially deleted live repo and the new content still in _____temp_____.
  • Cancellation: cancellationToken is checked between steps, so an aborted request can stop after the delete and before the move.

Suggestion: move the live repo aside first, e.g. Directory.Move into _____temp_____/{code}__replaced__{ts}, which is a cheap rename on the same volume. Then move the new repo into place, and delete the old one afterwards (best effort). That shrinks the gap to two renames and means the old data is never lost before the new data is in place. Also consider not honouring cancellation once the swap has started.

Same caveat as the temp-dir leak: this was ported from LexBox HgService, so the current LexBox behaviour is the same.

主要语言
C#
星标
0
派生
1
平均合并
1 天 20 小时
30 天内合并 PR
2

环境准备

  • 提供 Dockerfile 或 Docker Compose 文件
  • 没有 Pull Request 模板
  • 没有贡献指南

从这里开始

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

sillsdev/hgresume 的其他 Issue

查看 sillsdev/hgresume 的全部 Issue

相似的 Issue

更多 C# Issue

把新 issue 发到你的邮箱

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