]> git.ipfire.org Git - thirdparty/paperless-ngx.git/commitdiff
Fix: resolve cpu usage due to incorrect interval use (#8884)
authorshamoon <4887959+shamoon@users.noreply.github.com>
Thu, 23 Jan 2025 18:37:20 +0000 (10:37 -0800)
committerGitHub <noreply@github.com>
Thu, 23 Jan 2025 18:37:20 +0000 (10:37 -0800)
src-ui/src/app/components/document-list/document-card-large/document-card-large.component.ts
src-ui/src/app/components/document-list/document-card-small/document-card-small.component.ts

index 458b4ee6b78147ec91cff520850acd9efcfddb38..aaedf27aeee10fbfb26fd36bc326b9759fc17c4b 100644 (file)
@@ -13,6 +13,7 @@ import {
   NgbTooltipModule,
 } from '@ng-bootstrap/ng-bootstrap'
 import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons'
+import { delay, of } from 'rxjs'
 import {
   DEFAULT_DISPLAY_FIELDS,
   DisplayField,
@@ -104,9 +105,11 @@ export class DocumentCardLargeComponent
   popoverHidden = true
 
   ngAfterViewInit(): void {
-    setInterval(() => {
-      this.show = true
-    }, 100)
+    of(true)
+      .pipe(delay(50))
+      .subscribe(() => {
+        this.show = true
+      })
   }
 
   get searchScoreClass() {
index 2c318690dc4e2330480f3281d012d3c1ff0fab1c..9d5bcf704058856f877b6796762f6eb6e13568e0 100644 (file)
@@ -13,7 +13,8 @@ import {
   NgbTooltipModule,
 } from '@ng-bootstrap/ng-bootstrap'
 import { NgxBootstrapIconsModule } from 'ngx-bootstrap-icons'
-import { map } from 'rxjs/operators'
+import { of } from 'rxjs'
+import { delay, map } from 'rxjs/operators'
 import {
   DEFAULT_DISPLAY_FIELDS,
   DisplayField,
@@ -97,9 +98,11 @@ export class DocumentCardSmallComponent
   @ViewChild('popupPreview') popupPreview: PreviewPopupComponent
 
   ngAfterViewInit(): void {
-    setInterval(() => {
-      this.show = true
-    }, 50)
+    of(true)
+      .pipe(delay(50))
+      .subscribe(() => {
+        this.show = true
+      })
   }
 
   getIsThumbInverted() {