MatrixAI / js-rpc

Stream-based JSON RPC for JavaScript/TypeScript Applications
https://polykey.com
Apache License 2.0
4 stars 0 forks source link

fix: added grace time to client timeout #59

Closed tegefaulkes closed 10 months ago

tegefaulkes commented 10 months ago

Description

This PR fixes the following issues and addresses some general code clean up.

Issues Fixed

Tasks

Final checklist

ghost commented 10 months ago
👇 Click on the image for a new way to code review #### [![Review these changes using an interactive CodeSee Map](https://s3.us-east-2.amazonaws.com/maps.codesee.io/images/github/MatrixAI/js-rpc/59/2c9ee113/144d5e30eeec841ab5032d807fdc6a3ea18f344c.svg)](https://app.codesee.io/r/reviews?pr=59&src=https%3A%2F%2Fgithub.com%2FMatrixAI%2Fjs-rpc) #### Legend CodeSee Map legend
tegefaulkes commented 10 months ago

This should've never been merged into staging

    // Wait for server and client to timeout by checking the flag
    await new Promise<void>((resolve) => {
      const checkFlag = () => {
        if (serverTimedOut && clientTimedOut) resolve();
        else setTimeout(() => checkFlag(), 10);
      };
      checkFlag();
    });

I've removed it along with some other related code.

tegefaulkes commented 10 months ago

Ready for merge if anyone wants to have a look over it.

tegefaulkes commented 10 months ago

Most of the general clean up was just syntax and coding style fixes to keep things consistent. I added in some missing type annotation since it's better to be explicit about these things.