Task::CollectGarbage
Inherits Task::Singleton < Task < Ktistec::Model::Polymorphic < Ktistec::Model::Common < Ktistec::Model < Reference < Object
Garbage collection task for ActivityPub objects.
Garbage collection identifies and removes objects that are not connected to the user through preservation rules, described below.
How It Works
-
Identification: Identifies objects that should be preserved based on preservation rules, described below.
-
Deletion: Deletes objects and all associated records (tags, activities, relationships, translations).
-
Optimization: Runs SQLite VACUUM and OPTIMIZE to reclaim freed space.
Preservation Rules
Objects are preserved if they meet any of the following criteria:
-
Objects attributed to local users or to remote actors that local users follow
-
Objects associated with activities created by local users or by remote actors that local users follow
-
Objects with hashtags, mentions, or that are part of threads that local users follow
-
Objects in relationships with local users (timelines,
-
notifications, the outbox)
-
Objects in a thread (unless every object in the thread can be
-
deleted)
-
Recent objects
Of Note
-
Deleting an object will remove many associated records (activities, relationships, tags, translations), but never other objects.
-
Either entire threads are preserved or they are eligible for deletion.
Constants
Constructors
Returns the current active instance of this singleton task.
Creates and saves a new instance if no active instance exists.
Class methods
Ensures the singleton task is scheduled.
Typically called on server startup to ensure singleton tasks are created and scheduled.
Finds all objects that are part of the same thread as any preserved object.
Uses the "thread" column when available; falls back to the "in_reply_to_iri" column for legacy threads.
Instance methods
Deletes an object and associated records.
This method deletes the object and all records (except other
objects via the in_reply_to association) that reference that
object.
Returns the number of objects deleted.
Parameters
object_iri- The IRI of the object to delete
Performs garbage collection when scheduled.
Performs garbage collection on-demand.