Increase foreground refresh interval in DownloadsService to reduce CPU usage during updates
This commit is contained in:
parent
a25ed92a33
commit
80d32461d8
1 changed files with 3 additions and 3 deletions
|
|
@ -37,7 +37,7 @@ export class DownloadsService {
|
||||||
configurationChanged = new Subject<Record<string, unknown>>();
|
configurationChanged = new Subject<Record<string, unknown>>();
|
||||||
updated = new Subject<void>();
|
updated = new Subject<void>();
|
||||||
private updateRefreshScheduled = false;
|
private updateRefreshScheduled = false;
|
||||||
private readonly foregroundRefreshMs = 250;
|
private readonly foregroundRefreshMs = 3000;
|
||||||
private readonly backgroundRefreshMs = 30000;
|
private readonly backgroundRefreshMs = 30000;
|
||||||
|
|
||||||
configuration: Record<string, unknown> = {};
|
configuration: Record<string, unknown> = {};
|
||||||
|
|
@ -124,8 +124,8 @@ export class DownloadsService {
|
||||||
// Coalesce high-frequency download progress events into a capped refresh rate.
|
// Coalesce high-frequency download progress events into a capped refresh rate.
|
||||||
// requestAnimationFrame (~60fps) is smooth but expensive remotely and on large queues.
|
// requestAnimationFrame (~60fps) is smooth but expensive remotely and on large queues.
|
||||||
// We trade a little smoothness for much lower CPU:
|
// We trade a little smoothness for much lower CPU:
|
||||||
// - foreground: ~4fps
|
// - foreground: 1 per 3 seconds
|
||||||
// - background: 1/30 seconds
|
// - background: 1 per 30 seconds
|
||||||
if (this.updateRefreshScheduled) {
|
if (this.updateRefreshScheduled) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue