Skip to content
This repository was archived by the owner on May 27, 2025. It is now read-only.

Commit 670c8ad

Browse files
author
danecreekphotography
authored
Allow disabling purge interval (#401)
* Allow disabling purge interval Fixes #399 * Update changelog
1 parent 71d2bf9 commit 670c8ad

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Change Log
22

3+
## 5.6.0
4+
5+
- Support disabling auto-purge by specifying a `purgeInterval` of `0`. Resolves [issue 399](https://github.com/danecreekphotography/node-deepstackai-trigger/issues/399).
6+
37
## 5.5.1
48

59
- Resolve an issue where the system fails to start if no secrets file exists but the existing `settings.json` or `triggers.json` file uses

src/LocalStorageManager.ts

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -70,11 +70,19 @@ export async function copyToLocalStorage(location: Locations, fileName: string):
7070
* Starts a background task that purges old files from local storage.
7171
*/
7272
export function startBackgroundPurge(): void {
73-
log.verbose(
74-
"Local storage",
75-
`Enabling background purge every ${Settings.purgeInterval} minutes for files older than ${Settings.purgeAge} minutes.`,
76-
);
77-
purgeOldFiles();
73+
if (Settings.purgeInterval > 0) {
74+
log.verbose(
75+
"Local storage",
76+
`Enabling background purge every ${Settings.purgeInterval} minutes for files older than ${Settings.purgeAge} minutes.`,
77+
);
78+
purgeOldFiles();
79+
}
80+
else {
81+
log.verbose(
82+
"Local storage",
83+
`Background purge is disabled via settings.`,
84+
);
85+
}
7886
}
7987

8088
/**
@@ -110,7 +118,10 @@ async function purgeOldFiles(): Promise<void> {
110118
);
111119

112120
log.verbose("Local storage", "Purge complete");
113-
_backgroundTimer = setTimeout(purgeOldFiles, Settings.purgeInterval * _millisecondsInAMinute);
121+
122+
if (Settings.purgeInterval > 0 ) {
123+
_backgroundTimer = setTimeout(purgeOldFiles, Settings.purgeInterval * _millisecondsInAMinute);
124+
}
114125
}
115126

116127
/**

0 commit comments

Comments
 (0)