Skip to content

Commit 0832641

Browse files
committed
Merge branch 'main' into bufferlogs
2 parents 4dee930 + 5be6c70 commit 0832641

13 files changed

+55
-21
lines changed

coderd/coderd.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import (
1616
"github.com/andybalholm/brotli"
1717
"github.com/go-chi/chi/v5"
1818
"github.com/go-chi/chi/v5/middleware"
19+
"github.com/google/uuid"
1920
"github.com/klauspost/compress/zstd"
2021
"github.com/prometheus/client_golang/prometheus"
2122
"go.opentelemetry.io/otel/trace"
@@ -165,6 +166,7 @@ func New(options *Options) *API {
165166

166167
r := chi.NewRouter()
167168
api := &API{
169+
ID: uuid.New(),
168170
Options: options,
169171
RootHandler: r,
170172
siteHandler: site.Handler(site.FS(), binFS),
@@ -579,6 +581,11 @@ func New(options *Options) *API {
579581

580582
type API struct {
581583
*Options
584+
// ID is a uniquely generated ID on initialization.
585+
// This is used to associate objects with a specific
586+
// Coder API instance, like workspace agents to a
587+
// specific replica.
588+
ID uuid.UUID
582589
Auditor atomic.Pointer[audit.Auditor]
583590
WorkspaceClientCoordinateOverride atomic.Pointer[func(rw http.ResponseWriter) bool]
584591
WorkspaceQuotaEnforcer atomic.Pointer[workspacequota.Enforcer]

coderd/database/dump.sql

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ALTER TABLE workspace_agents
2+
DROP COLUMN last_connected_replica_id;
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
ALTER TABLE workspace_agents
2+
ADD COLUMN last_connected_replica_id uuid;

coderd/database/migrations/000070_provisioner_log_lines.down.sql

Whitespace-only changes.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ALTER TABLE provisioner_job_logs DROP COLUMN id;
2+
3+
ALTER TABLE provisioner_job_logs ADD COLUMN id uuid NOT NULL DEFAULT gen_random_uuid();

coderd/database/models.go

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries.sql.go

Lines changed: 22 additions & 13 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

coderd/database/queries/workspaceagents.sql

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ UPDATE
6464
SET
6565
first_connected_at = $2,
6666
last_connected_at = $3,
67-
disconnected_at = $4,
68-
updated_at = $5
67+
last_connected_replica_id = $4,
68+
disconnected_at = $5,
69+
updated_at = $6
6970
WHERE
7071
id = $1;
7172

0 commit comments

Comments
 (0)