feat: 1172 refresh feedsearch view asynchronically#1294
Merged
Conversation
…rse_geolocation_processor function configuration, enabling direct HTTP calls to the refresh_materialized_view function
…ke the `refresh_materialized_view` function in the `northamerica-northeast1` region
davidgamez
reviewed
Jul 28, 2025
| name = "refresh-materialized-view-task-queue" | ||
|
|
||
| rate_limits { | ||
| max_concurrent_dispatches = 2 |
Member
There was a problem hiding this comment.
Let's set this to 1. It shouldn't be more than one at the time
| PROJECT_ID = var.project_id | ||
| ENV = var.environment | ||
| PUBSUB_TOPIC_NAME = "rebuild-bounding-boxes-topic" | ||
| GOOGLE_FUNCTION_SOURCE = "src/main.py" |
Member
There was a problem hiding this comment.
Why is this change necessary? I don't see a src folder in the deployed function.
|
|
||
| # Enqueue the task | ||
| try: | ||
| client.create_task(request={"parent": parent, "task": task}) |
Member
There was a problem hiding this comment.
[suggestion]: Consider using the shared function, create_http_task. The shared function takes care of the authentication token.
Contributor
Author
There was a problem hiding this comment.
As discussed, will move the shared Logic into api/src/ and do a code refactoring due to direct imports not feasible (Docker/environment separation).
| from shared.database.database import with_db_session, refresh_materialized_view | ||
| from shared.database.database import ( | ||
| with_db_session, | ||
| create_refresh_materialized_view_task, |
Member
There was a problem hiding this comment.
I think we need to add google-cloud-tasks dependency to the requirements.txt file of this function
Co-authored-by: David Gamez <1192523+davidgamez@users.noreply.github.com>
….com:MobilityData/mobility-feed-api into 1172-refresh-feedsearch-view-asynchronically
e0a1035 to
474516b
Compare
474516b to
18d92ab
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
Closes #1172
created a refresh materialized view task executor that refresh feedsearch view asynchronously
bounced the refresh task timestamp to the next :00 or :30 to deduplicate multiple refreshes at the same time
Expected behavior:
Testing tips:
Provide tips, procedures and sample files on how to test the feature.
Testers are invited to follow the tips AND to try anything they deem relevant outside the bounds of the testing tips.
Please make sure these boxes are checked before submitting your pull request - thanks!
./scripts/api-tests.shto make sure you didn't break anything