Change MAX_CSV_SIZE_BYTES to 5 * 1024 * 1024
This commit is contained in:
parent
1ae07a1ca2
commit
a8fa60bc41
1 changed files with 2 additions and 2 deletions
|
|
@ -3,7 +3,7 @@ const path = require('node:path');
|
||||||
const log = require('../utils/log.js');
|
const log = require('../utils/log.js');
|
||||||
|
|
||||||
const CSV_FILE_PATH = path.join(__dirname, '..', 'reported_ips.csv');
|
const CSV_FILE_PATH = path.join(__dirname, '..', 'reported_ips.csv');
|
||||||
const MAX_CSV_SIZE_BYTES = 3 * 1024 * 1024; // 3 MB
|
const MAX_CSV_SIZE_BYTES = 5 * 1024 * 1024; // 5 MB
|
||||||
const CSV_HEADER = 'Timestamp,CF RayID,IP,Country,Hostname,Endpoint,User-Agent,Action taken,Status,Sefinek API\n';
|
const CSV_HEADER = 'Timestamp,CF RayID,IP,Country,Hostname,Endpoint,User-Agent,Action taken,Status,Sefinek API\n';
|
||||||
|
|
||||||
if (!fs.existsSync(CSV_FILE_PATH)) fs.writeFileSync(CSV_FILE_PATH, CSV_HEADER);
|
if (!fs.existsSync(CSV_FILE_PATH)) fs.writeFileSync(CSV_FILE_PATH, CSV_HEADER);
|
||||||
|
|
@ -12,7 +12,7 @@ const checkCSVSize = () => {
|
||||||
const stats = fs.statSync(CSV_FILE_PATH);
|
const stats = fs.statSync(CSV_FILE_PATH);
|
||||||
if (stats.size > MAX_CSV_SIZE_BYTES) {
|
if (stats.size > MAX_CSV_SIZE_BYTES) {
|
||||||
fs.writeFileSync(CSV_FILE_PATH, CSV_HEADER);
|
fs.writeFileSync(CSV_FILE_PATH, CSV_HEADER);
|
||||||
log(0, `CSV file size exceeded ${MAX_CSV_SIZE_BYTES / (1024 * 1024)} MB. File has been reset.`);
|
log(0, `The CSV file size exceeded ${MAX_CSV_SIZE_BYTES / (1024 * 1024)} MB. To save memory, its contents have been removed.`);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue