Skip to content

Move search index update to background #639

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

Merged
merged 3 commits into from
May 18, 2025

Conversation

DavidMStraub
Copy link
Member

Fixes #619.

Unit test missing.

@DavidMStraub DavidMStraub requested a review from Copilot May 16, 2025 06:15
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR moves the search index update process to a background task to improve request responsiveness and decouple the indexing process from the main transaction flow.

  • Introduces a new Celery task, update_search_indices_from_transaction, to update search indices asynchronously.
  • Replaces synchronous index updates in resource endpoints with run_task calls.
  • Adjusts JWT tree retrieval to use get_tree_from_jwt_or_fail for improved robustness.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
gramps_webapi/api/tasks.py Adds a new background task for updating search indices.
gramps_webapi/api/resources/objects.py Updates object resource to run the search index update task.
gramps_webapi/api/resources/base.py Replaces synchronous index updates with asynchronous task calls and updates type hints.

DavidMStraub and others added 2 commits May 16, 2025 08:43
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@DavidMStraub
Copy link
Member Author

Realized that existing unit tests in test_post, test_put, test_delete are enough.

@DavidMStraub DavidMStraub marked this pull request as ready for review May 16, 2025 08:02
@DavidMStraub DavidMStraub merged commit 56e4545 into gramps-project:master May 18, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Separate search index update from requests
1 participant