/opt/cloudlinux/venv/lib/python3.11/site-packages/ssa/__pycache__
Edit: /opt/cloudlinux/venv/lib/python3.11/site-packages/ssa/__pycache__/db.cpython-311.pyc (18639B)
§
b˜j0 ã ó‚ — d dl Z d dlZd dlZd dlZd dlmZmZ d dlmZmZm Z m
Z
mZmZm
Z
mZmZmZ d dlmZ d dlmZ d dlmZ d dlmZ d dlmZ d Zed
z ZdZ e¦ « Z ej d¦ « Z G d
„ de¦ « Z!d!d„Z"d„ Z#d„ Z$d„ Z%d„ Z&d„ Z'd„ Z(d„ Z)d„ Z*d„ Z+d"d„Z,d„ Z-d„ Z.d„ Z/ej0 defd „¦ « Z1dS )#é N)ÚdatetimeÚ timedelta)
ÚColumnÚBooleanÚDateTimeÚIndexÚIntegerÚStringÚ
create_engineÚeventÚfuncÚtext)Údeclarative_base)Ú Inspector)ÚSession)Úclose_all_sessions)Ú
DatabaseErrorz/var/lve/ssa.dbz.oldé Úcleanup_old_datac óä — e Zd ZdZdZ eddd¦ « fZ eed¬¦ « Z ee
d¬ ¦ « Z ee
d¬ ¦ « Z eed¬ ¦ « Z
eed¬ ¦ « Z eed¬ ¦ « Z eed¬ ¦ « Z eed¬ ¦ « Z eed¬ ¦ « Z eed¬ ¦ « Z e ed¬
¦ « ej ¦ « d¬¦ « Z e ed¬
¦ « ej ¦ « ej ¦ « ¬¦ « Zd
S )Ú
RequestResultay
Describes processed request stored in database file.
E.g.
{
"timestamp": "1650008727",
"url": "http://mydomain.com/index.php",
"duration": 162077,
"hitting_limits": false,
"throttled_time": 0,
"io_throttled_time": 0,
"wordpress": true
}
Note: created_at, updated_at is saved in local TZ format
Ú
scrape_resultÚix_scrape_result_domain_pathÚdomainÚpathT)Úprimary_keyF)Únullable)Útimezone)Úserver_defaultÚindex)Úonupdater N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú
__tablename__r Ú__table_args__r r Úidr
r r Ú timestampÚdurationr Úis_slow_requestÚhitting_limitsÚthrottled_timeÚio_throttled_timeÚ wordpressr r
ÚnowÚ
created_atÚ
updated_at© ó ú=/opt/cloudlinux/venv/lib64/python3.11/site-packages/ssa/db.pyr r sg € € € € € ðð ð" $€Mð �eÐ:¸HÀfÑMÔMÐO€Nà ˆ� TÐ *Ñ *Ô *€Bà
ˆV�F UÐ
+Ñ
+Ô
+€F؈6�& 5Ð)Ñ)Ô)€Dà��w¨Ð/Ñ/Ô/€Iàˆv�g¨Ð.Ñ.Ô.€HØ�f˜W¨uÐ5Ñ5Ô5€OØ�V˜G¨eÐ4Ñ4Ô4€NØ�V˜G¨eÐ4Ñ4Ô4€Nؘ˜w°Ð7Ñ7Ô7ÐØ��w¨Ð/Ñ/Ô/€Ið �˜˜¨$Ð/Ñ/Ô/ÀÀÄÁ
Ä
ÐRVÐWÑWÔW€JØ�˜˜¨$Ð/Ñ/Ô/¸(¸$¼(¹*¼*ÐU]ÐUYÔU]ÑU_ÔU_Ð`Ñ`Ô`€J€J€Jr4 r é' c óŽ — t j ¦ « t t ¬¦ « z
}d} t | ¦ « 5 }| t
d¦ « ||dœ¦ « }|j }||z
}|dk r
ddd¦ « n ddd¦ « n# 1 swxY w Y Œnt d|¦ « t | ¦ « dS )a
Removes outdated records from database, saving disk space.
Deletions are batched to avoid loading the entire database into
the cgroup's page cache, which causes OOM on large databases.
Runs VACUUM after deletion to reclaim disk space.
)Údaysr TzrDELETE FROM scrape_result WHERE rowid IN (SELECT rowid FROM scrape_result WHERE created_at < :cutoff LIMIT :batch))ÚcutoffÚbatchNzCleanup deleted %d old records)r Útodayr ÚRETENTION_TIME_DAYSÚ
session_scopeÚexecuter ÚrowcountÚloggerÚinfoÚvacuum_database)ÚengineÚ
batch_sizeÚ
n_days_agoÚ
total_deletedÚsessionÚresultÚdeleteds r5 r r S s6 € õ ”Ñ!Ô!¥IÕ3FÐ$GÑ$GÔ$GÑG€JØ€MðÝ
˜6Ñ
"Ô
"ð gØ—_’_Ýð`ñô ð &°
Ð;Ð;ñô ˆFð ”oˆGؘWÑ$ˆMؘ!Š|ˆ|Øð ð ð ñ ô ð ð ð ð ð ð ñ ô ð ð ð ð ð ð øøøð ð ð ð ðõ ‡K‚KÐ0°-Ñ@Ô@Ð@Ý�FÑÔÐÐÐs ¼:BÂBÂBc ój — t j t j t ¦ « ¦ « }t j |t j ¦ « r6| d|› d�¦ « t d|¦ « dS t
d||¦ « dS )u¹
Point SQLite's temp store at the database directory (on disk) for the
given operation. SQLite spills large sorts / temp B-trees and VACUUM
copies to the system temp directory, which can be tmpfs (RAM-backed).
When it is, the spill is charged against the MemoryMax=1G cgroup and
OOM-kills the agent on large databases — the same hazard for VACUUM
and for index builds / ORDER BY sorts (CLPRO-2819, CLPRO-3077).
úPRAGMA temp_store_directory = 'ú'z&Set SQLite temp_store_directory to: %szJDirectory %s not writable. %s will fall back to the default temp location.N)Úosr ÚdirnameÚabspathÚSSA_DBÚaccessÚW_OKr> r@ rA Úwarning)ÚcursorÚ operationÚdb_dirs r5 Ú_redirect_temp_store_to_diskrW m s” € õ ŒW�_Š_�RœWŸ_š_VÑ4Ô4Ñ
5Ô
5€FÝ „y��œÑ!Ô!ð xØ�ŠÐB¸ÐBÐBÐBÑCÔCÐCÝ�ŠÐ<¸fÑEÔEÐEÐEÐEå�ŠÐcÐekÐmvÑwÔwÐwÐwÐwr4 c óH — | ¦ « }|j } d|_ | ¦ « }t |d¦ « t d¦ « | d¦ « t d¦ « | ¦ « nA# t $ r4}t dt |¦ « › �¦ « Y d}~nd}~ww xY w||_ | ¦ « dS # ||_ | ¦ « w xY w)zŽ
Run VACUUM command to reclaim disk space after deletions.
VACUUM must be run outside of a transaction, so we use raw connection.
NÚVACUUMzStarting VACUUM operation...zVACUUM completed successfully.zVACUUM failed: )Úraw_connectionÚisolation_levelrT rW r@ rA r> ÚcloseÚ ExceptionÚerrorÚstr)rC Úraw_connÚoriginal_isolation_levelrT Úes r5 rB rB ~ s! € ð ×$Ò$Ñ&Ô&€HØ'Ô7ÐðØ#'ˆÔ Ø—’Ñ"Ô"ˆå$ V¨XÑ6Ô6Ð6å�ŠÐ2Ñ3Ô3Ð3Ø�Š�xÑ Ô Ð Ý�ŠÐ4Ñ5Ô5Ð5à�ЉŒˆˆøÝð 1ð 1ð 1Ý�ŠÐ/¥s¨1¡v¤vÐ/Ð/Ñ0Ô0Ð0Ð0Ð0Ð0Ð0Ð0øøøøð1øøøð $<ˆÔ Ø�ŠÑÔÐÐÐøð $<ˆÔ Ø�ŠÑÔÐÐøøøs0 �BB&