mirror of
https://github.com/onyx-dot-app/onyx.git
synced 2026-10-23 20:02:57 -05:00
* first cut at redis * some new helper functions for the db * ignore kombu tables in alembic migrations (used by celery) * multiline commands for readability, add vespa_metadata_sync queue to worker * typo fix * fix returning tuple fields * add constants * fix _get_access_for_document * docstrings! * fix double function declaration and typing * fix type hinting * add a global redis pool * Add get_document function * use task_logger in various celery tasks * add celeryconfig.py to simplify configuration. Will be used in a subsequent commit * Add celery redis helper. used in a subsequent PR * kombu warning getting spammy since celery is not self managing its queue in Postgres any more * add last_modified and last_synced to documents * fix task naming convention * use celeryconfig.py * the big one. adds queues and tasks, updates functions to use the queues with priorities, etc * change vespa index log line to debug * mypy fixes * update alembic migration * fix fence ordering, rename to "monitor", fix fetch_versioned_implementation call * mypy * switch to monotonic time * fix startup dependencies on redis * rebase alembic migration * kombu cleanup - fail silently * mypy * add redis_host environment override * update REDIS_HOST env var in docker-compose.dev.yml * update the rest of the docker files * harden indexing-status endpoint against db changes happening in the background. Needs further improvement but OK for now. * allow no task syncs to run because we create certain objects with no entries but initially marked as out of date * add back writing to vespa on indexing * update contributing guide * backporting fixes from background_deletion * renaming cache to cache_volume * add redis password to various deployments * try setting up pr testing for helm * fix indent * hopefully this release version actually exists * fix command line option to --chart-dirs * fetch-depth 0 * edit values.yaml * try setting ct working directory * bypass testing only on change for now * move files and lint them * update helm testing * some issues suggest using --config works * add vespa repo * add postgresql repo * increase timeout * try amd64 runner * fix redis password reference * add comment to helm chart testing workflow * rename helm testing workflow to disable it * adding clarifying comments * address code review * missed a file * remove commented warning ... just not needed --------- Co-authored-by: Richard Kuo <rkuo@rkuo.com>
27 lines
874 B
Python
27 lines
874 B
Python
from sqlalchemy.orm import Session
|
|
|
|
from danswer.db.tasks import check_task_is_live_and_not_timed_out
|
|
from danswer.db.tasks import get_latest_task
|
|
from danswer.utils.logger import setup_logger
|
|
from ee.danswer.background.task_name_builders import name_chat_ttl_task
|
|
|
|
logger = setup_logger()
|
|
|
|
|
|
def should_perform_chat_ttl_check(
|
|
retention_limit_days: int | None, db_session: Session
|
|
) -> bool:
|
|
# TODO: make this a check for None and add behavior for 0 day TTL
|
|
if not retention_limit_days:
|
|
return False
|
|
|
|
task_name = name_chat_ttl_task(retention_limit_days)
|
|
latest_task = get_latest_task(task_name, db_session)
|
|
if not latest_task:
|
|
return True
|
|
|
|
if latest_task and check_task_is_live_and_not_timed_out(latest_task, db_session):
|
|
logger.info("TTL check is already being performed. Skipping.")
|
|
return False
|
|
return True
|