feat(sync): 全部历史真的是全部,不再截断在两年

730 天是个凭空写死的上限。账号有七年数据的人选「全部历史」,拿到的是
最近两年,而且没有任何提示说剩下的被丢掉了。

* 全部历史现在一直回溯到账号最早的数据:连续 EMPTY_RUN_STOP(120) 天
  完全没有内容就停,所以既不会截断,也不会去问手表存在之前的年份。
  MAX_HISTORY_DAYS(3650) 只是兜底,可用环境变量覆盖。
* 已经存过的日期跳过(最近 3 天除外,它们还在写入中)。这让多年的
  回填变成可续传的:撞上限流停下来,冷却过后再点一次就从断点继续,
  而不是每次都从今天重新爬。
* 选择器补上 3 年 / 5 年。
* 前端把每个范围的实际代价写出来,并说明中断可续。

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
ericwyuan
2026-09-01 09:30:03 +08:00
parent 526ece7d14
commit 92ea33b800
5 changed files with 97 additions and 12 deletions

View File

@@ -28,7 +28,7 @@ const historyLabel = (days: number) =>
/** What each range actually costs, so the choice is made with eyes open. */
const rangeHint = (days: number) =>
days === -1 ? '只补上次同步之后缺的那几天,最快'
: days === 0 ? '约 730 天2040 分钟'
: days === 0 ? '一直回到账号最早的数据,可能要分几次才拉得完'
: days >= 365 ? `${days} 天,大约 ${Math.ceil((days * 3) / 60)} 分钟`
: `${days} 天,几分钟`;
@@ -420,7 +420,8 @@ function SyncPage() {
</div>
<p className="field-hint">
{total > 60 ? `预计还需 ${Math.ceil(((total - current) * 3) / 60)} 分钟` : ''}
{total > 60 ? `最多还需 ${Math.ceil(((total - current) * 3) / 60)} 分钟` : ''}
{total > 365 && '已经存过的日期会跳过,所以中途被打断也不用从头再来。'}
</p>
</section>
) : (