Add nightly realm reports and observed bot activity explanations
Core tests / core (push) Successful in 59s
Core tests / core (push) Successful in 59s
This commit is contained in:
@@ -78,6 +78,17 @@ try:
|
||||
count=recovery.publish_recovery_intents(current,cfg)
|
||||
maintenance.append(f'Recovery intentions refreshed for {count} residents')
|
||||
except Exception as e:maintenance.append('Recovery check needs attention: '+type(e).__name__)
|
||||
try:
|
||||
recovery_rows=[]
|
||||
try:
|
||||
for line in sql('SELECT id,guid,name,UNIX_TIMESTAMP(at),detail FROM acore_auth.azerothai_recovery_log ORDER BY id DESC LIMIT 100').splitlines():
|
||||
fields=line.split('\t',4)
|
||||
recovery_rows.append(dict(id=int(fields[0]),guid=int(fields[1]),name=fields[2],at=int(fields[3]),detail=fields[4]))
|
||||
except Exception as e:maintenance.append('Recovery history unavailable: '+type(e).__name__)
|
||||
request=urllib.request.Request(base+'/api/realm-insights',data=json.dumps({'at':time.time(),'recoveries':recovery_rows}).encode(),headers={'Content-Type':'application/json','Authorization':'Bearer '+cfg['AUTONOMY_TOKEN']})
|
||||
with urllib.request.urlopen(request,timeout=20) as response:assert response.status==200
|
||||
maintenance.append('Realm report sampled')
|
||||
except Exception as e:maintenance.append('Realm report needs attention: '+type(e).__name__)
|
||||
try:
|
||||
backup_status=json.loads((lab/'backups/latest-status.json').read_text())
|
||||
maintenance.append(('Backup restored and verified: ' if backup_status.get('ok') else 'BACKUP NEEDS ATTENTION: ')+str(backup_status.get('at','unknown')))
|
||||
|
||||
Reference in New Issue
Block a user