Skip to content

Agent New Settings Config With Default API values & Apply Logics

MR: Sync Full & Partial Reconcilation From Rails & ... (!1495 - merged)

Description

With new settings section passed into the reconcilation API, on the agent side, we should be able to receive the values, and then we do simple validation, so nothing bad goes on, and then we apply new settings as required

Acceptance Criteria

  • new settings feild with two nested fields full_reconciliation_interval_seconds and partial_reconciliation_interval_seconds
  • handle missing settings field from API result, or settings exists with missing full or parial interval
  • apply both values at the end of business logic, so these changes do not interrept the ongoing flow, and only affect the next cycle

Technical Requirements

In structure, we add new fields

type ResponsePayload struct {
	WorkspaceRailsInfos []*WorkspaceRailsInfo `json:"workspace_rails_infos"`
	Settings            *Settings             `json:"settings"`
}

type Settings struct {
	FullReconciliationIntervalSeconds    int `json:"full_reconciliation_interval_seconds"`
	PartialReconciliationIntervalSeconds int `json:"partial_reconciliation_interval_seconds"`
}

Then when we Unmarshal the api payload, we provide the default values, so missing fields do not matter.

Then we return 2 time.duration from reconciler.go into worker.go, and we apply values as needed.

Pls note when we finish a full reconciliation, now we will reset both full and partial timer. This is especially useful when we start up the process, then we give it correct both full and partial reconciliation values. Also it seems make sense to me, when full reconciliation finished, we do not do another immediate partial reconciliation.

Design Requirements

None, no UI impact.

Impact Assessment

  • Instance admins may want to override these values to either provide faster update and reconciliation for workspaces, or to reduce load on the monolith.
  • Developers may want to override these values so they can have faster feedback when developing features, e.g. have a much faster full reconciliation interval than an hour. Otherwise they have to hack the hardcoded intervals, or restart their agent to force a full reconcile.
Edited by zli