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

CoderWorkspacePoolMember: recognize a template-wide last_used_at write in a one-member pool

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

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

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

调研方向

Start from the CoderWorkspacePoolMember logic that compares a workspace's last_used_at with the template's updated_at within a 5 s window, and from the 60 s poll that decides whether a member is Used. Reproduce the case where a template schedule update runs, the template changes again before the next poll, and the pool has one member. Done when that member is no longer marked Used and the single-member and multi-member witness paths are both covered by tests. The suggested fix adds one list call, only when the template time does not match.

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

描述

Problem

A CoderWorkspacePoolMember treats a later last_used_at as use, except for a template-wide write. It recognizes a template-wide write in two ways: the value is within 5 s of the template's updated_at, or another unclaimed member of the pool already moved its baseline to the same value.

When a template schedule update with update_workspace_last_used_at runs, and the template changes again before the next 60 s poll, and no other member of the pool saw the first write (for example a one-member pool), the member marks itself Used. The pool releases it, and one warm workspace leaks.

This is the fail-safe direction: the controller never deletes a workspace that someone may use. But it costs one workspace per affected member.

Possible fix

Also accept as a witness any other workspace of the template in Coder with the same last_used_at (one list call, only when the template time does not match).

Trigger

Before the PR 12 activation docs of #153, or a user report.

Found by Codex on #343 (comment 4268119093).

Refs #153

Found in review of #343 (thread 4268119093); the plan resolves the ambiguity toward Used, which can leak one warm workspace but never deletes possible work.

Refs #153


Generated with xum • Model: anthropic:claude-opus-5-5 • Thinking: medium

主要语言
Go
星标
5
派生
3
平均合并
3 小时
30 天内合并 PR
192

环境准备

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

从这里开始

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

coder/coder-k8s 的其他 Issue

查看 coder/coder-k8s 的全部 Issue

相似的 Issue

更多 Go Issue

把新 issue 发到你的邮箱

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