From 3d85fa30e651c1afc767c9a3224eaad58f8922e2 Mon Sep 17 00:00:00 2001
From: Lukas Haase <lukas.haase@mni.thm.de>
Date: Mon, 26 Jul 2021 15:42:42 +0200
Subject: [PATCH] eslint fix, call service on subscribe and then every 5
 seconds

---
 src/app/services/http/active-user.service.ts | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/app/services/http/active-user.service.ts b/src/app/services/http/active-user.service.ts
index 410ff4c39..80d7d83fc 100644
--- a/src/app/services/http/active-user.service.ts
+++ b/src/app/services/http/active-user.service.ts
@@ -18,7 +18,7 @@ export class ActiveUserService extends BaseHttpService {
     super();
   }
 
-  public getActiveUser(room: Room):Observable<any>{
+  public getActiveUser(room: Room): Observable<any>{
     const url = '/api/roomsubscription/usercount?ids='+room.id;
     return this.http.get(url, httpOptions).pipe(
       tap(_ => ''),
@@ -26,14 +26,16 @@ export class ActiveUserService extends BaseHttpService {
     );
   }
 
-  public observeUserActivity(room:Room,a:(num:number)=>void):()=>void{
-    const interval=setInterval(()=>{
+  public observeUserActivity(room: Room,a: (num: number) => void): () => void{
+    const f=()=>{
       this.getActiveUser(room).subscribe(e=>{
         if(e&&e.length>0){
           a(e[0]);
         }
-      })
-    },5000);
+      });
+    };
+    f();
+    const interval=setInterval(()=>f(),5000);
     return ()=>clearInterval(interval);
   }
 
-- 
GitLab