diff --git a/app/terraform/proxy/meta.py b/app/terraform/proxy/meta.py index c80b24a..a2550bc 100644 --- a/app/terraform/proxy/meta.py +++ b/app/terraform/proxy/meta.py @@ -168,13 +168,14 @@ def promote_hot_spare_proxy(pool_id: int, origin: Origin) -> bool: This function searches for a 'hot spare' proxy (a proxy in reserve pool with pool_id == -1) for the given origin. If a proxy is found, it is promoted to the specified pool by changing its pool ID. + The added timestamp is also reset to the time at which the hot spare was promoted. :param pool_id: The pool to which the 'hot spare' proxy is to be promoted. :param origin: The origin of the 'hot spare' proxy to be promoted. :return: True if a 'hot spare' proxy was found and promoted, False otherwise. - .. note:: In the database, the pool ID -1 signifies a reserve pool of 'hot spare' proxies. This pool does not - appear in the pool table and is only used as a sentinel value. + .. note:: In the database, the pool ID -1 signifies a reserve pool of 'hot spare' proxies. This pool is created by + default in the schema migrations. """ proxy = Proxy.query.filter( Proxy.pool_id == -1, @@ -183,6 +184,7 @@ def promote_hot_spare_proxy(pool_id: int, origin: Origin) -> bool: if not proxy: return False proxy.pool_id = pool_id + proxy.added = datetime.datetime.utcnow() return True