worker

package
v0.0.0-...-72e56ea Latest Latest
Warning

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

Go to latest
Published: May 8, 2026 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TaskQueue  = "api-page-cache"
	WorkflowID = "api-page-cache"
)

Variables

This section is empty.

Functions

func PageCacheWorkflow

func PageCacheWorkflow(ctx temporalworkflow.Context, iteration int) error

PageCacheWorkflow is a long-running workflow that refreshes all page caches every 30s. It uses continue-as-new after 60 iterations (~30 min) to keep workflow history bounded.

func Start

func Start(ctx context.Context, cfg Config) error

Start connects to Temporal, registers workflows and activities, then runs the page cache worker. It blocks until ctx is cancelled or an error occurs.

Types

type Activities

type Activities struct {
	Log *slog.Logger
	API *handlers.API
	// contains filtered or unexported fields
}

Activities holds the logger and API deps for the refresh activity.

func (*Activities) RefreshCaches

func (a *Activities) RefreshCaches(ctx context.Context) error

RefreshCaches refreshes all page cache entries, writing results to Postgres.

func (*Activities) RefreshLatestCaches

func (a *Activities) RefreshLatestCaches(ctx context.Context) error

RefreshLatestCaches refreshes just the fast-cadence entries (latest slots slice).

type Config

type Config struct {
	Log *slog.Logger
	API *handlers.API
}

Config configures the page cache worker.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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