This commit is contained in:
Aevann1 2022-01-11 05:02:59 +02:00
parent c1058df11b
commit 2bdc7e65eb
3 changed files with 6 additions and 5 deletions

View file

@ -554,6 +554,8 @@ def archiveorg(url):
def thumbnail_thread(pid):
db = db_session()
print(cpu_percent(), flush=True)
time.sleep(0.1)
@ -571,8 +573,8 @@ def thumbnail_thread(pid):
kind="enable_under_attack",
user_id=AUTOJANNY_ID,
)
g.db.add(ma)
g.db.commit()
db.add(ma)
db.commit()
data='{"value":"under_attack"}'
response = requests.patch(f'https://api.cloudflare.com/client/v4/zones/{CF_ZONE}/settings/security_level', headers=CF_HEADERS, data=data)
print(response.text, flush=True)
@ -591,8 +593,6 @@ def thumbnail_thread(pid):
else:
return f"{post_url}{'/' if not post_url.endswith('/') else ''}{fragment_url}"
db = db_session()
post = db.query(Submission).filter_by(id=pid).one_or_none()
if not post or not post.url: