maintenance

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Sep 25, 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) SetModelInfoService

func (s *Service) SetModelInfoService(mi modelInfoRefresher)

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

func (*Service) SetProxyServices

func (s *Service) SetProxyServices(proxySvc *proxypool.Service, luaSvc *luaplugin.Service)

SetProxyServices wires the proxy pool and plugin service for periodic pool rotation and source fetching.

func (*Service) SetProxyTickInterval added in v0.0.7

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

SetProxyTickInterval sets the automatic proxy rotation period.

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