in Library/Sender.ts [66:100]
public setDiskRetryMode(value: boolean, resendInterval?: number, maxBytesOnDisk?: number) {
if (value) {
FileAccessControl.checkFileProtection(); // Only check file protection when disk retry is enabled
}
this._enableDiskRetryMode = FileAccessControl.OS_PROVIDES_FILE_PROTECTION && value;
if (typeof resendInterval === 'number' && resendInterval >= 0) {
this._resendInterval = Math.floor(resendInterval);
}
if (typeof maxBytesOnDisk === 'number' && maxBytesOnDisk >= 0) {
this._maxBytesOnDisk = Math.floor(maxBytesOnDisk);
}
if (value && !FileAccessControl.OS_PROVIDES_FILE_PROTECTION) {
this._enableDiskRetryMode = false;
Logging.warn(Sender.TAG, "Ignoring request to enable disk retry mode. Sufficient file protection capabilities were not detected.")
}
if (this._enableDiskRetryMode) {
if (this._statsbeat) {
this._statsbeat.addFeature(Constants.StatsbeatFeature.DISK_RETRY);
}
// Starts file cleanup task
if (!this._fileCleanupTimer) {
this._fileCleanupTimer = setTimeout(() => { this._fileCleanupTask(); }, Sender.CLEANUP_TIMEOUT);
this._fileCleanupTimer.unref();
}
}
else {
if (this._statsbeat) {
this._statsbeat.removeFeature(Constants.StatsbeatFeature.DISK_RETRY);
}
if (this._fileCleanupTimer) {
clearTimeout(this._fileCleanupTimer);
}
}
}