Ver código fonte

Fix session terminated behavior and update test

Steven Silvester 5 anos atrás
pai
commit
022e4d9647

+ 8 - 1
packages/services/src/session/manager.ts

@@ -339,7 +339,14 @@ export class SessionManager implements Session.IManager {
     // or that the session JS object is disposed and the session still exists on
     // the server, so we refresh from the server to make sure we reflect the
     // server state.
-    void this.refreshRunning();
+    this.refreshRunning().catch(e => {
+      // Ignore poll rejection that arises if we are disposed
+      // during this call.
+      if (this.isDisposed) {
+        return;
+      }
+      throw e;
+    });
   }
 
   /**

+ 1 - 0
tests/test-services/src/session/manager.spec.ts

@@ -144,6 +144,7 @@ describe('session/manager', () => {
           called = true;
         });
         await s.shutdown();
+        await manager.refreshRunning();
         expect(called).to.equal(true);
       });