Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CleanupWorker ¶
type CleanupWorker struct {
// contains filtered or unexported fields
}
CleanupWorker periodically deletes Slackbot sessions whose last message is older than SessionTTL. It uses the agentapi.proxy/slack-last-message-at annotation (or created-at as a fallback) to determine when the last message occurred.
func NewCleanupWorker ¶
func NewCleanupWorker( sessionManager portrepos.SessionManager, k8sClient kubernetes.Interface, namespace string, config CleanupWorkerConfig, ) *CleanupWorker
NewCleanupWorker creates a new CleanupWorker.
type CleanupWorkerConfig ¶
type CleanupWorkerConfig struct {
// CheckInterval is how often the worker scans for stale sessions.
// Default: 1h
CheckInterval time.Duration
// SessionTTL is the duration after the last message before a session is deleted.
// Default: 72h (3 days)
SessionTTL time.Duration
// Enabled controls whether the worker actually runs.
Enabled bool
}
CleanupWorkerConfig holds configuration for the Slackbot session cleanup worker.
func DefaultCleanupWorkerConfig ¶
func DefaultCleanupWorkerConfig() CleanupWorkerConfig
DefaultCleanupWorkerConfig returns the default configuration.
type LeaderCleanupWorker ¶
type LeaderCleanupWorker struct {
// contains filtered or unexported fields
}
LeaderCleanupWorker combines leader election with the Slackbot cleanup worker. Only the elected leader runs the cleanup loop, preventing duplicate deletions in multi-replica deployments.
func NewLeaderCleanupWorker ¶
func NewLeaderCleanupWorker( sessionManager portrepos.SessionManager, k8sClient kubernetes.Interface, namespace string, workerConfig CleanupWorkerConfig, electionConfig schedule.LeaderElectionConfig, ) *LeaderCleanupWorker
NewLeaderCleanupWorker creates a new LeaderCleanupWorker.
func (*LeaderCleanupWorker) Run ¶
func (lw *LeaderCleanupWorker) Run(ctx context.Context)
Run starts the leader election loop. Only the leader runs the cleanup worker.
func (*LeaderCleanupWorker) Stop ¶
func (lw *LeaderCleanupWorker) Stop()
Stop gracefully stops the leader cleanup worker.