prune

package
v0.13.0 Latest Latest
Warning

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

Go to latest
Published: Dec 15, 2023 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var All action.GTSAction = func(ctx context.Context) error {

	prune, err := setupPrune(ctx)
	if err != nil {
		return err
	}

	defer func() {

		if err := prune.shutdown(); err != nil {
			log.Error(ctx, err)
		}
	}()

	if config.GetAdminMediaPruneDryRun() {
		log.Info(ctx, "prune DRY RUN")
		ctx = gtscontext.SetDryRun(ctx)
	}

	days := config.GetMediaRemoteCacheDays()

	prune.cleaner.Media().All(ctx, days)
	prune.cleaner.Emoji().All(ctx, days)

	if err := prune.storage.Storage.Clean(ctx); err != nil {
		log.Error(ctx, "error cleaning storage: %v", err)
	}

	return nil
}

All performs all media clean actions

View Source
var Orphaned action.GTSAction = func(ctx context.Context) error {

	prune, err := setupPrune(ctx)
	if err != nil {
		return err
	}

	defer func() {

		if err := prune.shutdown(); err != nil {
			log.Error(ctx, err)
		}
	}()

	if config.GetAdminMediaPruneDryRun() {
		log.Info(ctx, "prune DRY RUN")
		ctx = gtscontext.SetDryRun(ctx)
	}

	prune.cleaner.Media().LogPruneOrphaned(ctx)

	if err := prune.storage.Storage.Clean(ctx); err != nil {
		log.Error(ctx, "error cleaning storage: %v", err)
	}

	return nil
}

Orphaned prunes orphaned media from storage.

View Source
var Remote action.GTSAction = func(ctx context.Context) error {

	prune, err := setupPrune(ctx)
	if err != nil {
		return err
	}

	defer func() {

		if err := prune.shutdown(); err != nil {
			log.Error(ctx, err)
		}
	}()

	if config.GetAdminMediaPruneDryRun() {
		log.Info(ctx, "prune DRY RUN")
		ctx = gtscontext.SetDryRun(ctx)
	}

	t := time.Now().Add(-24 * time.Hour * time.Duration(config.GetMediaRemoteCacheDays()))

	prune.cleaner.Media().LogPruneUnused(ctx)
	prune.cleaner.Media().LogUncacheRemote(ctx, t)

	if err := prune.storage.Storage.Clean(ctx); err != nil {
		log.Error(ctx, "error cleaning storage: %v", err)
	}

	return nil
}

Remote prunes old and/or unused remote media.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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