fix: bound cold website smoke requests independently of health polling

This commit is contained in:
Nick Beckley 2026-11-27 22:57:59 +00:00
parent 6ec4fd7258
commit f620dc0623

View File

@ -11,9 +11,9 @@ class NoRedirect(HTTPRedirectHandler):
def redirect_request(self,*args):return None
HTTP=build_opener(NoRedirect())
def response_bytes(url,limit):
def response_bytes(url,limit,timeout=3):
require(url.startswith('http://127.0.0.1:'),'Health must remain on loopback')
with HTTP.open(url,timeout=3) as response:
with HTTP.open(url,timeout=timeout) as response:
data=response.read(limit+1)
require(response.status==200 and 0<len(data)<=limit,'Unexpected or oversized smoke response')
return data
@ -128,7 +128,10 @@ def activate(release,validate=False,rollback=False):
require(ready,'Website health/source identity failed')
receipt['health']=health
base=cfg['url'].removesuffix('/health')
receipt['smokeTests']=[{'path':path,'status':200,'bytes':len(response_bytes(base+path,1024**2))}
# Cold solver graph loading on web1 takes about five seconds.
# Keep a bounded warm-up allowance; redirects/size limits and
# all five mandatory route checks still apply.
receipt['smokeTests']=[{'path':path,'status':200,'bytes':len(response_bytes(base+path,1024**2,timeout=15))}
for path in ['/','/pricing','/help','/problem-solver','/sitemap.xml']]
(root/'active-deployment.json').write_bytes(canonical(receipt|{'status':'activated'}))
receipt['status']='validated' if validate else 'activated'