mirror of
https://github.com/tubearchivist/tubearchivist
synced 2024-11-02 09:41:07 +00:00
add snapshot check at startup
This commit is contained in:
parent
c392563ef8
commit
814de87768
@ -6,6 +6,7 @@ import sys
|
||||
from django.apps import AppConfig
|
||||
from home.src.es.connect import ElasticWrap
|
||||
from home.src.es.index_setup import index_check
|
||||
from home.src.es.snapshot import ElasticSnapshot
|
||||
from home.src.ta.config import AppConfig as ArchivistConfig
|
||||
from home.src.ta.ta_redis import RedisArchivist
|
||||
|
||||
@ -30,6 +31,7 @@ class StartupCheck:
|
||||
self.sync_redis_state()
|
||||
self.set_redis_conf()
|
||||
self.make_folders()
|
||||
self.snapshot_check()
|
||||
self.set_has_run()
|
||||
|
||||
def get_has_run(self):
|
||||
@ -81,6 +83,14 @@ class StartupCheck:
|
||||
if response:
|
||||
print("deleted leftover key from redis: " + lock)
|
||||
|
||||
def snapshot_check(self):
|
||||
"""setup snapshot config, create if needed"""
|
||||
active = self.config_handler.config["application"]["enable_snapshot"]
|
||||
if not active:
|
||||
return
|
||||
|
||||
ElasticSnapshot().setup()
|
||||
|
||||
def is_invalid(self, version):
|
||||
"""return true if es version is invalid, false if ok"""
|
||||
major, minor = [int(i) for i in version.split(".")[:2]]
|
||||
|
Loading…
Reference in New Issue
Block a user