mirror of
https://github.com/jokob-sk/NetAlertX.git
synced 2025-12-07 09:36:05 -08:00
WAL truncating #769
This commit is contained in:
@@ -204,13 +204,18 @@ def cleanup_database (dbPath, DAYS_TO_KEEP_EVENTS, PHOLUS_DAYS_DATA, HRS_TO_KEEP
|
||||
|
||||
conn.commit()
|
||||
|
||||
# Check WAL file size
|
||||
cursor.execute("PRAGMA wal_checkpoint(TRUNCATE);")
|
||||
cursor.execute("PRAGMA wal_checkpoint(FULL);")
|
||||
|
||||
mylog('verbose', [f'[{pluginName}] WAL checkpoint executed to truncate file.'])
|
||||
|
||||
# Shrink DB
|
||||
mylog('verbose', [f'[{pluginName}] Shrink Database'])
|
||||
cursor.execute ("VACUUM;")
|
||||
|
||||
# Close the database connection
|
||||
conn.close()
|
||||
|
||||
conn.close()
|
||||
|
||||
|
||||
#===============================================================================
|
||||
|
||||
@@ -44,7 +44,7 @@ def handleEmpty(input):
|
||||
return 'null'
|
||||
else:
|
||||
# Validate and sanitize message content
|
||||
# Remove potentially problematic characters if string
|
||||
# Remove potentially problematic characters in string
|
||||
if isinstance(input, str):
|
||||
input = re.sub(r'[^\x00-\x7F]+', ' ', input)
|
||||
input = input.replace('\n', '') # Removing new lines
|
||||
|
||||
Reference in New Issue
Block a user