jobs

package
v0.0.0-...-8798775 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2024 License: MIT Imports: 33 Imported by: 1

Documentation

Index

Constants

View Source
const DATA_DELETE_JOB = "USER_DATA_DELETE_JOB"
View Source
const FREE_JOB_NAME = "FREE_CREDITS_JOB"
View Source
const HEALTH_JOB_NAME = "HEALTH_JOB"
View Source
const PRUNE_OLDER_THAN = 5 * time.Minute

Prune messages older than this time

View Source
const PRUNE_OLD_QUEUE_JOB_NAME = "PRUNE_OLD_QUEUE_JOB"

Variables

This section is empty.

Functions

func CreateTestGeneration

func CreateTestGeneration(log Logger, apiKey string) error

Types

type JobLogger

type JobLogger struct {
	JobName string
}

func NewJobLogger

func NewJobLogger(jobName string) *JobLogger

func (*JobLogger) Errorf

func (j *JobLogger) Errorf(s string, args ...any)

func (*JobLogger) Infof

func (j *JobLogger) Infof(s string, args ...any)

type JobRunner

type JobRunner struct {
	Repo      *repository.Repository
	Redis     *database.RedisWrapper
	Ctx       context.Context
	Discord   *discord.DiscordHealthTracker
	Track     *analytics.AnalyticsService
	Stripe    *stripe.API
	S3        *s3.S3
	S3Img2Img *s3.S3
	Qdrant    *qdrant.QdrantClient
	MQClient  queue.MQClient
}

func (*JobRunner) AddFreeCreditsToEligibleUsers

func (j *JobRunner) AddFreeCreditsToEligibleUsers(log Logger) error

func (*JobRunner) CheckSCWorkerHealth

func (j *JobRunner) CheckSCWorkerHealth(log Logger) error

CheckHealth cron job

func (*JobRunner) DeleteUserData

func (j *JobRunner) DeleteUserData(log Logger, dryRun bool) error

func (*JobRunner) GetAndSetStats

func (j *JobRunner) GetAndSetStats(log Logger) error

func (*JobRunner) GetGenerationOutputCount

func (j *JobRunner) GetGenerationOutputCount() (int, error)

func (*JobRunner) GetUpscaleOutputCount

func (j *JobRunner) GetUpscaleOutputCount() (int, error)

func (*JobRunner) GetVoiceoverOutputCount

func (j *JobRunner) GetVoiceoverOutputCount() (int, error)

func (*JobRunner) PruneOldQueueItems

func (j *JobRunner) PruneOldQueueItems(log Logger) error

PruneOldQueueItems cron job

func (*JobRunner) RefundOldGenerationCredits

func (j *JobRunner) RefundOldGenerationCredits(log Logger) error

func (*JobRunner) StartAutoUpscaleJob

func (j *JobRunner) StartAutoUpscaleJob(log Logger)

func (*JobRunner) SyncStripe

func (j *JobRunner) SyncStripe(log Logger) error

Sync stripe subscriptions with active user products

type Logger

type Logger interface {
	Infof(s string, args ...any)
	Errorf(s string, args ...any)
}

Just wrap logger so we can include the job name without repeating it

type RequestBody

type RequestBody struct {
	Prompt     string `json:"prompt"`
	Width      int    `json:"width"`
	Height     int    `json:"height"`
	NumOutputs int    `json:"num_outputs"`
}

type ResponseBody

type ResponseBody struct {
	Outputs []struct {
		ID       string `json:"id"`
		URL      string `json:"url"`
		ImageURL string `json:"image_url"`
	} `json:"outputs"`
}

Jump to

Keyboard shortcuts

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