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

Refresh search view concurrently #1612

Merged
merged 1 commit into from
Jun 5, 2023
Merged
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
9 changes: 7 additions & 2 deletions dandiapi/api/tasks/scheduled.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,14 @@ def send_pending_users_email() -> None:

@shared_task(soft_time_limit=60)
def refresh_materialized_view_search() -> None:
"""Execute a REFRESH MATERIALIZED VIEW query to update the view used by asset search."""
"""
Execute a REFRESH MATERIALIZED VIEW query to update the view used by asset search.

Note that this is a "concurrent" refresh, which means that the view will be
updated without locking the table.
"""
with connection.cursor() as cursor:
cursor.execute('REFRESH MATERIALIZED VIEW asset_search;')
cursor.execute('REFRESH MATERIALIZED VIEW CONCURRENTLY asset_search;')


def register_scheduled_tasks(sender: Celery, **kwargs):
Expand Down