maintenance

package
v0.3.7 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package maintenance implements the Provider Maintenance & Rotation Service.

Responsibilities:

  • Periodically scanning all credentials for those that need refresh
  • Delegating refresh to the appropriate provider backend
  • Persisting updated credentials via the Credential Pool Service

Design principles:

  • Flexible: no hardcoded refresh logic — each backend decides its own strategy
  • Non-blocking: runs in a background goroutine; errors are logged, not fatal
  • Jitter-free: each check interval is fixed; backends decide when NeedsRefresh is true

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service runs background maintenance tasks for provider credentials.

func New

func New(credSvc *credential.Service, providerSvc *provider.Service, db *db.DB, logger *slog.Logger) *Service

New constructs a new maintenance Service with the default check interval.

func (*Service) RunStartupRefresh added in v0.3.7

func (s *Service) RunStartupRefresh(ctx context.Context)

RunStartupRefresh refreshes stale credentials and cleans expired auth flows synchronously. The server calls it before listening so a restarted router never exposes expired keys to live traffic. Model sync stays on the ticker. It never fails startup: every outcome logs inside the pass, and cancellation only stops launching new workers.

func (*Service) SetModelInfoService

func (s *Service) SetModelInfoService(mi modelInfoRefresher)

SetModelInfoService wires model metadata refresh for providers with config.models_auto_sync enabled.

func (*Service) Start

func (s *Service) Start(ctx context.Context)

Start launches the maintenance loop in a background goroutine. It stops when ctx is cancelled.

func (*Service) WithInterval

func (s *Service) WithInterval(d time.Duration) *Service

WithInterval overrides the check interval (useful for testing).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL