INNER CODE UNIT · Go

agentFlushGrace

VersusControl/versus-incident · cmd/main.go:284

const agentFlushGrace = 15 * time.Second

func registerToolAvailabilityController(app *fiber.App, availability *agent.ToolAvailabilityService, services ...*kubernetes.Service) {
	controllers.NewAgentToolsAdminController(availability.Manager, availability.Snapshot).Register(app.Group("/api"))
	var kubernetesService *kubernetes.Service
	if len(services) > 0 {
		kubernetesService = services[0]
	}
	controllers.NewKubernetesAdminControllerWithRegistry(kubernetes.NewServiceRegistry(kubernetesService)).Register(app.Group("/api"))
}

// startAgent constructs the worker, starts it in a goroutine, and registers
// admin routes on the fiber app. It returns the catalog so the caller can
// hold a reference (and so future hot-reload code has a handle to it), plus a
// channel that closes when the worker has finished its shutdown flush.
func startAgent(ctx context.Context, app *fiber.App, cfg c.AgentConfig, gatewaySecret string, store storage.Provider, rdb redis.UniversalClient, toolAvailability *agent.ToolAvailabilityService, kubernetesService *kubernetes.Service, healthManager *servicehealth.Manager) (*agent.Catalog, <-chan struct{}, error) {
	// On the Postgres backend, install the typed signal-table
	// catalog store so the log catalog reads/writes the explicit

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…