sessionbatch

package
v0.1.147 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2026 License: GPL-2.0, GPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package sessionbatch implements batched session activity updates to reduce SQLite write-lock acquisitions.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BatchUpdater

type BatchUpdater interface {
	BatchUpdateSessionActivity(ctx context.Context, tokenHashes []string, now time.Time) error
}

BatchUpdater is the interface for batch session activity updates.

type Batcher

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

Batcher collects session activity updates and flushes them in batches to reduce SQLite write-lock acquisitions.

func New

func New(ctx context.Context, db BatchUpdater) *Batcher

New creates and starts a Batcher that flushes pending updates every 500ms or when 16 updates accumulate.

func (*Batcher) Send

func (b *Batcher) Send(hash string, at time.Time)

Send enqueues a session activity update. Non-blocking; drops if buffer full.

func (*Batcher) Stop

func (b *Batcher) Stop()

Stop signals the batcher to flush remaining updates and exit.

Jump to

Keyboard shortcuts

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