Files
cobol-java-v3/.claude/skills/code-review/references/manual-review/distributed-lock.md
T
NB-076 2f61ad7f1a feat: 集成code-review skill到项目
- 项目级 skill: .claude/skills/code-review/ (398行SKILL.md + 参考文件)
- 自动触发: AI修改.py/.cbl/.cpy/.lark后自动review
- CLAUDE.md: 定义触发规则、review流程、严重级别
- .code-review.yaml: tier=standard, 高风险模块配置

效果: clone即用, 每次代码变更后自动审查, 防止低质量代码入库
Co-Authored-By: Claude <noreply@anthropic.com>
2026-06-25 10:24:15 +08:00

1005 B

Distributed Lock — Manual Review Checklist

Timeout Strategy

  • Lock TTL defined and justified (not arbitrary)
  • TTL exceeds maximum expected operation time
  • Watchdog/refresh mechanism if operation may exceed TTL
  • Lock auto-releases on process crash (not permanent deadlock)

Release Mechanism

  • Lock released by the same instance that acquired it (ownership check)
  • Release is atomic (check-then-release is not atomic — use Lua script or compare-and-delete)
  • Lock release in finally/defer block guaranteed to execute

Retry Strategy

  • Retry with exponential backoff, not infinite retry
  • Maximum retry count or timeout defined
  • Failed lock acquisition returns clear error (not silent fallback)

Granularity & Deadlock

  • Lock key granularity appropriate (per-resource, not global)
  • Multiple lock acquisition order consistent (prevents deadlock)
  • No nested locks on same resource
  • Lock contention monitored/metrics available