Skip to content

Use per-deployment keys for race-free deployment tracking#747

Merged
EhabY merged 1 commit intocoder:mainfrom
EhabY:race-free-deployment-tracking
Jan 23, 2026
Merged

Use per-deployment keys for race-free deployment tracking#747
EhabY merged 1 commit intocoder:mainfrom
EhabY:race-free-deployment-tracking

Conversation

@EhabY
Copy link
Collaborator

@EhabY EhabY commented Jan 22, 2026

Summary

  • Replace shared coder.deploymentUsage list with per-deployment coder.access.<hostname>
    keys to eliminate race conditions when multiple VS Code windows access deployments concurrently
  • Derive known hostnames from secrets.keys() instead of maintaining a separate list,
    simplifying the implementation and ensuring consistency
  • Fix test flakiness by using fake timers to ensure distinct timestamps

@EhabY EhabY self-assigned this Jan 22, 2026
Replace shared deployment usage list with per-deployment access
timestamps and derive known hostnames from secrets.keys(). This
eliminates race conditions when multiple VS Code windows access
simultaneously.

Changes:
- Store access timestamps in per-deployment memento keys instead of
a shared list that could lose data during concurrent writes
- Derive known hostnames from secrets.keys() instead of
maintaining a separate list, simplifying the implementation
- Add error handling in listStoredDeployments() and pruning logic
- Fix test flakiness by using fake timers for timestamp ordering
@EhabY EhabY force-pushed the race-free-deployment-tracking branch from 70c21d0 to a05a04c Compare January 22, 2026 15:00
Copy link
Member

@mtojek mtojek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@EhabY EhabY merged commit 50b9957 into coder:main Jan 23, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants