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 option to disable cron job #392

Merged
merged 2 commits into from
Nov 23, 2023
Merged
Show file tree
Hide file tree
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
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
4 changes: 4 additions & 0 deletions boofilsic/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,10 @@
"users/OAuth2_login/",
RedirectView.as_view(url="/account/login/oauth", query_string=True),
),
path(
"auth/edit", # some apps like elk will use this url
RedirectView.as_view(url="/account/profile", query_string=True),
),
path("", include("catalog.urls")),
path("", include("journal.urls")),
path("timeline/", include("social.urls")),
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