Part of lp.services.webapp
|Class||LaunchpadTimeoutError||A variant of TimeoutError that reports the original PostgreSQL error.|
|Class||RequestExpired||Request has timed out.|
|Function||set_request_started||Set the start time for the request being served by the current|
|Function||clear_request_started||Clear the request timer. This function should be called when|
|Function||summarize_requests||Produce human-readable summary of requests issued so far.|
|Function||get_timeline_actions||Return an iterable of timeline actions.|
|Function||get_request_statements||Get the list of executed statements in the request.|
|Function||get_request_start_time||Get the time at which the request started.|
|Function||get_request_duration||Get the duration of the current request in seconds.|
|Function||set_permit_timeout_from_features||Control request timeouts being obtained from the 'hard_timeout' flag.|
|Function||get_request_remaining_seconds||Return how many seconds are remaining in the current request budget.|
|Function||set_launchpad_default_timeout||Set the LAZR default timeout function on IProcessStartingEvent.|
|Function||soft_timeout_expired||Returns True if the soft request timeout been reached.|
|Function||start_sql_logging||Turn the sql data logging on.|
|Function||stop_sql_logging||Turn off the sql data logging and return the result.|
|Class||StormAccessFromMainThread||The main thread must not access the database via Storm.|
|Function||break_main_thread_db_access||Ensure that Storm connections are not made in the main thread.|
|Class||LaunchpadDatabase||No class docstring; 1/3 methods documented|
|Class||LaunchpadTimeoutTracer||Storm tracer class to keep statement execution time bounded.|
|Class||LaunchpadStatementTracer||Storm tracer class to log executed statements.|
|Function||get_store||Return a flavored Store for the given database class.|
|Function||get_master_store||Return the master Store for the given database class.|
|Function||get_slave_store||Return the master Store for the given database class.|
|Function||get_object_from_master_store||Return a copy of the given object retrieved from its master Store.|
|Function||get_store_name||Helper to retrieve the store name for a ZStorm Store.|
|Class||WhichDbView||A page that reports which database is being used by default.|
|Function||_get_dirty_commit_flags||Return the current dirty commit status|
|Function||_reset_dirty_commit_flags||Set the dirty commit status to False unless previous is True|
|Function||_get_request_timeout||Get the timeout value in ms for the current request.|
Set the start time for the request being served by the current thread. :param start_time: The start time of the request. If given, it is used as the start time for the request, as returned by time(). If it is not given, the current time is used. :param request_statements; The sequence used to store the logged SQL statements. :type request_statements: mutable sequence. :param txn: The current transaction manager. If given, txn.commit() and txn.abort() calls are logged too. :param enable_timeout: If True, a timeout error is raised if the request runs for a longer time than the configured timeout.
The list is composed of (starttime, endtime, db_id, statement) tuples. Times are given in milliseconds since the start of the request.
Until we've fully setup a page to render - routed the request to the right object, setup a participation etc, feature flags cannot be completely used; and because doing feature flag lookups will trigger DB access, attempting to do a DB lookup will cause a nested DB lookup (the one being done, and the flags lookup). To resolve all of this, timeouts start as a config file only setting, and are then overridden once the request is ready to execute.
|Parameters||enabled||If True permit looking up request timeouts in feature flags.|
Get the timeout value in ms for the current request. :param timeout: A custom timeout in ms. :return None or a time in ms representing the budget to grant the request.
If timeouts are disabled, None is returned.
|Parameters||no_exception||If True, do not raise an error if the request is out of time. Instead return a float e.g. -2.0 for 2 seconds over budget.|
|now||Override the result of time.time()|
|timeout||A custom timeout in ms.|
|Returns||None or a float representing the remaining time budget.|
When the app server is running, we want ensure we don't use the connection cache from the main thread as this would only be done on process startup and would leave an open connection dangling, wasting resources.
This method is invoked by an IProcessStartingEvent - it would be easier to do on module load, but the test suite has legitimate uses for using connections from the main thread.
Returns the object if it already comes from the relevant master Store.
Registered as a trusted adapter, so if the input is security wrapped, so is the result. Otherwise an unwrapped object is returned.