mirror of
https://gitlab.com/KevinRoebert/ClearUrls
synced 2025-12-15 21:55:36 +07:00
Hard limit for the log of 5000 entries
This commit is contained in:
@@ -21,6 +21,9 @@
|
||||
* This script is responsible for some tools.
|
||||
*/
|
||||
|
||||
// Max amount of log entries to prevent performance issues
|
||||
const logThreshold = 5000;
|
||||
|
||||
/*
|
||||
* To support Waterfox.
|
||||
*/
|
||||
@@ -293,8 +296,6 @@ function handleError(error) {
|
||||
/**
|
||||
* Function to log all activities from ClearUrls.
|
||||
* Only logging when activated.
|
||||
* The log is only temporary saved in the cache and will
|
||||
* permanently saved with the saveLogOnClose function.
|
||||
*
|
||||
* @param beforeProcessing the url before the clear process
|
||||
* @param afterProcessing the url after the clear process
|
||||
@@ -302,11 +303,10 @@ function handleError(error) {
|
||||
*/
|
||||
function pushToLog(beforeProcessing, afterProcessing, rule) {
|
||||
const limit = storage.logLimit;
|
||||
if (storage.loggingStatus && limit !== 0) {
|
||||
if (limit > 0 && !isNaN(limit)) {
|
||||
while (storage.log.log.length >= limit) {
|
||||
storage.log.log.shift();
|
||||
}
|
||||
if (storage.loggingStatus && limit !== 0 && !isNaN(limit)) {
|
||||
while (storage.log.log.length >= limit
|
||||
|| storage.log.log.length >= logThreshold) {
|
||||
storage.log.log.shift();
|
||||
}
|
||||
|
||||
storage.log.log.push(
|
||||
|
||||
Reference in New Issue
Block a user