feat: Add support for update checks and notifications (#4810)

Co-authored-by: Kira Pilot <kira@coder.com>
This commit is contained in:
Mathias Fredriksson
2022-12-01 19:43:28 +02:00
committed by GitHub
co-authored by Kira Pilot
parent 4f1cf6c9d8
commit d9f2aaf3b4
32 changed files with 1088 additions and 22 deletions
+22 -3
View File
@@ -119,9 +119,10 @@ type data struct {
workspaceResources []database.WorkspaceResource
workspaces []database.Workspace
deploymentID string
derpMeshKey string
lastLicenseID int32
deploymentID string
derpMeshKey string
lastUpdateCheck []byte
lastLicenseID int32
}
func (fakeQuerier) IsFakeDB() {}
@@ -3272,6 +3273,24 @@ func (q *fakeQuerier) GetDERPMeshKey(_ context.Context) (string, error) {
return q.derpMeshKey, nil
}
func (q *fakeQuerier) InsertOrUpdateLastUpdateCheck(_ context.Context, data string) error {
q.mutex.RLock()
defer q.mutex.RUnlock()
q.lastUpdateCheck = []byte(data)
return nil
}
func (q *fakeQuerier) GetLastUpdateCheck(_ context.Context) (string, error) {
q.mutex.RLock()
defer q.mutex.RUnlock()
if q.lastUpdateCheck == nil {
return "", sql.ErrNoRows
}
return string(q.lastUpdateCheck), nil
}
func (q *fakeQuerier) InsertLicense(
_ context.Context, arg database.InsertLicenseParams,
) (database.License, error) {