Skip to content

Commit

Permalink
add options to disable cron jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
Her Email authored and alphatownsman committed Nov 23, 2023
1 parent 382558b commit 82e7bd5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion boofilsic/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
NEODB_DOWNLOADER_CACHE_TIMEOUT=(int, 300),
# Number of retries of downloader, when site is using RetryDownloader
NEODB_DOWNLOADER_RETRIES=(int, 3),
# Disable cron jobs
NEODB_DISABLE_CRON=(bool, False),
# INTEGRATED TAKAHE CONFIGURATION
TAKAHE_DB_URL=(str, "postgres://takahe:[email protected]:5432/takahe"),
# Spotify - https://developer.spotify.com/
Expand Down Expand Up @@ -220,6 +222,8 @@
DOWNLOADER_CACHE_TIMEOUT = env("NEODB_DOWNLOADER_CACHE_TIMEOUT")
DOWNLOADER_RETRIES = env("NEODB_DOWNLOADER_RETRIES")

DISABLE_CRON = env("NEODB_DISABLE_CRON")

# ====== USER CONFIGUTRATION END ======

DATABASE_ROUTERS = ["takahe.db_routes.TakaheRouter"]
Expand Down Expand Up @@ -502,7 +506,7 @@
# CORS_ALLOWED_ORIGINS = []
# CORS_ALLOWED_ORIGIN_REGEXES = []
CORS_ALLOW_ALL_ORIGINS = True
CORS_URLS_REGEX = r"^/api/.*$"
CORS_URLS_REGEX = r"^/(api|nodeinfo)/.*$"
CORS_ALLOW_METHODS = (
"DELETE",
"GET",
Expand Down
5 changes: 4 additions & 1 deletion common/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,9 @@ def run(self):
Indexer.init()

# Register cron jobs if not yet
JobManager.schedule_all()
if settings.DISABLE_CRON:
logger.info("Cron jobs are disabled.")
else:
JobManager.schedule_all()

logger.info("Finished post-migration setup.")
1 change: 1 addition & 0 deletions compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ x-shared:
NEODB_LOGIN_MASTODON_WHITELIST:
NEODB_MASTODON_CLIENT_SCOPE:
NEODB_DISABLE_DEFAULT_RELAY:
NEODB_DISABLE_CRON:
NEODB_SENTRY_DSN:
TAKAHE_SENTRY_DSN:
NEODB_DB_URL: postgres://neodb:aubergine@neodb-db/neodb
Expand Down

0 comments on commit 82e7bd5

Please sign in to comment.