Right now the list of predefined database queries is stored in cloud storage and loaded into global variables at cold start of a function instance. Subsequent function calls reuse the same global variables, saving time when executing the function. Global variables can persist on an instance for about 10 minutes after the last function invocation. More info: https://cloud.google.com/functions/docs/bestpractices/tips#functions-tips-scopes-python.
This can be confusing if a developer is changing the database query object and then running live tests, as the new queries will not be ingested until the current instance shuts down and a new one starts. My current solution to this issue is to delete and rebuild the db-query function every time I upload new queries. A less cumbersome solution might be to add a flag so that the queries are always reloaded on function invocation, when in a development environment.
Right now the list of predefined database queries is stored in cloud storage and loaded into global variables at cold start of a function instance. Subsequent function calls reuse the same global variables, saving time when executing the function. Global variables can persist on an instance for about 10 minutes after the last function invocation. More info: https://cloud.google.com/functions/docs/bestpractices/tips#functions-tips-scopes-python.
This can be confusing if a developer is changing the database query object and then running live tests, as the new queries will not be ingested until the current instance shuts down and a new one starts. My current solution to this issue is to delete and rebuild the db-query function every time I upload new queries. A less cumbersome solution might be to add a flag so that the queries are always reloaded on function invocation, when in a development environment.