File tree Expand file tree Collapse file tree 1 file changed +10
-1
lines changed
functions-python/reverse_geolocation/src Expand file tree Collapse file tree 1 file changed +10
-1
lines changed Original file line number Diff line number Diff line change 77
88import flask
99import pandas as pd
10+ import requests
1011import shapely .geometry
1112from geoalchemy2 import WKTElement
1213from geoalchemy2 .shape import to_shape
@@ -375,7 +376,15 @@ def extract_location_aggregates(
375376
376377 # Commit the changes to the database before refreshing the materialized view
377378 db_session .commit ()
378- refresh_materialized_view (db_session , t_feedsearch .name )
379+
380+ # Replace direct call to refresh_materialized_view with HTTP request to GCP function
381+ function_url = os .getenv ("FUNCTION_URL_REFRESH_MV" )
382+ if not function_url :
383+ raise ValueError ("FUNCTION_URL_REFRESH_MV environment variable is not set" )
384+
385+ response = requests .get (f"{ function_url } /refresh-materialized-view" )
386+ response .raise_for_status ()
387+ logger .info ("Materialized view refresh event triggered successfully." )
379388
380389
381390@with_db_session
You can’t perform that action at this time.
0 commit comments