Rename GC worker package to gc
This commit is contained in:
parent
420a5e5a3a
commit
76c9339453
6 changed files with 4 additions and 4 deletions
19
workers/gc/gcworker.py
Normal file
19
workers/gc/gcworker.py
Normal file
|
@ -0,0 +1,19 @@
|
|||
from app import app
|
||||
from data.database import UseThenDisconnect
|
||||
from workers.gc.models_pre_oci import pre_oci_model as model
|
||||
from workers.worker import Worker
|
||||
|
||||
class GarbageCollectionWorker(Worker):
|
||||
def __init__(self):
|
||||
super(GarbageCollectionWorker, self).__init__()
|
||||
self.add_operation(self._garbage_collection_repos,
|
||||
app.config.get('GARBAGE_COLLECTION_FREQUENCY', 30))
|
||||
|
||||
def _garbage_collection_repos(self):
|
||||
""" Performs garbage collection on repositories. """
|
||||
with UseThenDisconnect(app.config):
|
||||
model.perform_garbage_collection()
|
||||
|
||||
if __name__ == "__main__":
|
||||
worker = GarbageCollectionWorker()
|
||||
worker.start()
|
Reference in a new issue