Compare commits
No commits in common. "ca477733172df704ceca0171d3f51d1a1c75250b" and "ce33617aa68b3f69c29bc58ef8699d4f75f9e1bf" have entirely different histories.
ca47773317
...
ce33617aa6
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "real-debrid-downloader",
|
||||
"version": "1.7.138",
|
||||
"version": "1.7.137",
|
||||
"description": "Desktop downloader",
|
||||
"main": "build/main/main/main.js",
|
||||
"author": "Sucukdeluxe",
|
||||
|
||||
@ -1569,15 +1569,6 @@ export class DownloadManager extends EventEmitter {
|
||||
|
||||
private statsCacheAt = 0;
|
||||
|
||||
/** Cache for cloneSettings() results in getSnapshot() — invalidated after 400ms
|
||||
* or by explicit invalidateSettingsSnapshotCache() calls. */
|
||||
private settingsSnapshotCache: AppSettings | null = null;
|
||||
private settingsSnapshotCacheAt = 0;
|
||||
private invalidateSettingsSnapshotCache(): void {
|
||||
this.settingsSnapshotCache = null;
|
||||
this.settingsSnapshotCacheAt = 0;
|
||||
}
|
||||
|
||||
private lastPersistAt = 0;
|
||||
private lastSettingsPersistAt = 0;
|
||||
private appSessionStartedAt = 0;
|
||||
@ -1943,7 +1934,6 @@ export class DownloadManager extends EventEmitter {
|
||||
const now = nowMs();
|
||||
next.totalRuntimeAllTimeMs = Math.max(next.totalRuntimeAllTimeMs || 0, this.getLiveTotalRuntimeMs(now));
|
||||
this.settings = next;
|
||||
this.invalidateSettingsSnapshotCache();
|
||||
this.runtimePersistedTotalMs = this.settings.totalRuntimeAllTimeMs || 0;
|
||||
this.runtimePersistedAt = now;
|
||||
this.ensureProviderDailyUsageFresh(nowMs());
|
||||
@ -2057,23 +2047,7 @@ export class DownloadManager extends EventEmitter {
|
||||
const reconnectMs = Math.max(0, this.session.reconnectUntil - now);
|
||||
|
||||
const snapshotSession = cloneSession(this.session);
|
||||
// Cache the cloneSettings result for ~400ms. Settings are mutated in-place
|
||||
// (so a reference check wouldn't detect changes) but most snapshot ticks
|
||||
// happen close together (e.g. 700ms emit interval) where settings haven't
|
||||
// changed at all. Cloning 85+ fields + 6 nested usage Maps + bandwidth
|
||||
// schedules every ~700ms is wasteful when we can serve from cache for
|
||||
// most of those ticks. The 400ms TTL ensures user-driven settings changes
|
||||
// become visible within one render cycle of normal snapshot timing.
|
||||
// Manual invalidation via invalidateSettingsSnapshotCache() is called by
|
||||
// any code path that needs immediate visibility (replaceSettings, etc.).
|
||||
let snapshotSettings: AppSettings;
|
||||
if (this.settingsSnapshotCache && now - this.settingsSnapshotCacheAt < 400) {
|
||||
snapshotSettings = this.settingsSnapshotCache;
|
||||
} else {
|
||||
snapshotSettings = cloneSettings(this.settings);
|
||||
this.settingsSnapshotCache = snapshotSettings;
|
||||
this.settingsSnapshotCacheAt = now;
|
||||
}
|
||||
const snapshotSettings = cloneSettings(this.settings);
|
||||
const snapshotSummary = this.summary
|
||||
? { ...this.summary }
|
||||
: null;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user