mirror of
https://github.com/coder/coder.git
synced 2025-07-13 21:36:50 +00:00
feat: Add workspace agent lifecycle state reporting (#5785)
This commit is contained in:
committed by
GitHub
parent
dbfeb5630c
commit
138887de7e
@ -2789,6 +2789,7 @@ func (q *fakeQuerier) InsertWorkspaceAgent(_ context.Context, arg database.Inser
|
||||
ConnectionTimeoutSeconds: arg.ConnectionTimeoutSeconds,
|
||||
TroubleshootingURL: arg.TroubleshootingURL,
|
||||
MOTDFile: arg.MOTDFile,
|
||||
LifecycleState: database.WorkspaceAgentLifecycleStateCreated,
|
||||
}
|
||||
|
||||
q.workspaceAgents = append(q.workspaceAgents, agent)
|
||||
@ -4294,3 +4295,20 @@ func (q *fakeQuerier) GetQuotaConsumedForUser(_ context.Context, userID uuid.UUI
|
||||
}
|
||||
return sum, nil
|
||||
}
|
||||
|
||||
func (q *fakeQuerier) UpdateWorkspaceAgentLifecycleStateByID(_ context.Context, arg database.UpdateWorkspaceAgentLifecycleStateByIDParams) error {
|
||||
if err := validateDatabaseType(arg); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
q.mutex.Lock()
|
||||
defer q.mutex.Unlock()
|
||||
for i, agent := range q.workspaceAgents {
|
||||
if agent.ID == arg.ID {
|
||||
agent.LifecycleState = arg.LifecycleState
|
||||
q.workspaceAgents[i] = agent
|
||||
return nil
|
||||
}
|
||||
}
|
||||
return sql.ErrNoRows
|
||||
}
|
||||
|
Reference in New Issue
Block a user