Revert "Disable Cloudflare API call timing out admin_home."

This reverts commit ed27225d10.

The proximal cause of the request timeout issues was the /comments
performance issues, which seem to have been resolved by 2edeb4875.
Probably still need to refactor this, but for now it's likely fine.
master
Snakes 2022-10-13 02:12:35 -04:00
parent 2edeb48751
commit e7da195645
Signed by: Snakes
GPG Key ID: E745A82778055C7E
1 changed files with 4 additions and 8 deletions

View File

@ -425,14 +425,10 @@ def reported_comments(v):
def admin_home(v):
under_attack = False
### TODO: This is timing out in gevent, something to do with _SSLErrorReadTimeout.
### For some reason it manages to take down all the workers in the process.
### Major service disruptions. Non-essential, so will resolve later. [2022-10-13]
### TODO: Make more robust to API outages/timeouts. And move to a helper.
#if v.admin_level >= PERMS['SITE_SETTINGS_UNDER_ATTACK']:
# if CF_ZONE == 'blahblahblah': response = 'high'
# else: response = requests.get(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/settings/security_level', headers=CF_HEADERS, timeout=5).json()['result']['value']
# under_attack = response == 'under_attack'
if v.admin_level >= PERMS['SITE_SETTINGS_UNDER_ATTACK']:
if CF_ZONE == 'blahblahblah': response = 'high'
else: response = requests.get(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/settings/security_level', headers=CF_HEADERS, timeout=5).json()['result']['value']
under_attack = response == 'under_attack'
gitref = admin_git_head()