Open
Conversation
| try: | ||
| response = requests.post( | ||
| revalidate_url, | ||
| json={"feedId": feed_stable_id}, |
Contributor
There was a problem hiding this comment.
the body is
{
type: 'specific-feeds'
feedIds: [feed_stable_id]
}
Contributor
Author
There was a problem hiding this comment.
Thanks! The API didnt return any error tho
Contributor
There was a problem hiding this comment.
In the revalidate endpoint the default values are set to
type: 'specific-feeds',
feedIds: [],
so it wont fail if you input the wrong body. Would it be a good practice to return an error of "missing param"?
Contributor
Author
There was a problem hiding this comment.
I think at least type should be required! A readme would be nice (suggestion 😄)
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 MobilityData/mobilitydatabase-web#67
This pull request introduces a new mechanism to trigger web app cache revalidation via Google Cloud Tasks whenever certain backend processes update or modify feed data. The integration ensures that the web application remains in sync with backend changes by scheduling deduplicated revalidation tasks for affected feeds.
Web app revalidation integration:
create_web_revalidation_taskingcp_utils.pyto enqueue deduplicated Cloud Tasks for web app cache revalidation, with error handling and logging. This function is called after feed updates inbatch_process_dataset,pmtiles_builder,process_validation_report, andreverse_geolocation_processorto ensure the web app reflects backend changes promptly. [1] [2] [3] [4] [5]tasks_executorconfiguration to include theWEB_APP_REVALIDATE_SECRETsecret, which is used for secure revalidation requests.test_web_revalidation.py, covering edge cases and error handling.Workflow and deployment updates:
api-deployer.yml,api-dev.yml,api-qa.yml,api-prod.yml) to support new inputs and secrets for web app revalidation, including passing the revalidation URL and secret from 1Password. [1] [2] [3] [4] [5] [6]Dependency management:
google-cloud-taskstoapi/requirements.txtto support the new task scheduling functionality.Codebase imports and structure:
create_web_revalidation_taskfunction where appropriate. [1] [2] [3] [4] [5]These changes collectively ensure that the web application cache is automatically and efficiently revalidated after backend feed updates, improving data consistency and user experience.
Summarize the changes in the pull request including how it relates to any issues (include the #number, or link them).
Please make sure these boxes are checked before submitting your pull request - thanks!
./scripts/api-tests.shto make sure you didn't break anything