Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add occ db:add-missing-indices #113

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion daemon/nextbox_daemon/jobs.py
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,31 @@ def _run(self, cfg, board, kwargs):
return False


class AddMissingIndicesJob(BaseJob):
name = "AddMissingIndices"

def __init__(self):
self.nc = Nextcloud()
super().__init__(initial_interval=900)

def _run(self, cfg, board, kwargs):
# run only once
self.interval = None

# only add missing indices, if nextcloud is installed
if not self.nc.is_installed:
log.debug("cannot add missing indices - uninitialized nextcloud")
self.interval = 15
return False

try:
self.nc.run_cmd("db:add-missing-indices")
except NextcloudError:
log.warning("cannot add missing indices")
self.interval = 15
return False


class PurgeOldDockerImagesJob(BaseJob):
"""
Job to periodically purge old images using
Expand Down Expand Up @@ -554,6 +579,6 @@ def _send_update_notification(self):
LEDJob, FactoryResetJob, BackupRestoreJob, EnableNextBoxAppJob,
SelfUpdateJob, HardwareStatusUpdateJob,
TrustedDomainsJob, RenewCertificatesJob, DynDNSUpdateJob,
EnableHTTPSJob, ReIndexAllFilesJob,
EnableHTTPSJob, ReIndexAllFilesJob, AddMissingIndicesJob,
PurgeOldDockerImagesJob, OccUpgradeJob, AdminNotification,
]