kiteco / kite-connect-js

JS connector module to Kite client
BSD 3-Clause "New" or "Revised" License
8 stars 14 forks source link

Laggy requests #16

Closed dbratz1177 closed 5 years ago

dbratz1177 commented 5 years ago

Notes on testing: https://kite.quip.com/9LcOAtXD9csO

Connected PRs:

This solves the general issue of having editor lag with VSCode and Atom plugins while typing with Kite Engine off, and is the result of a decent detailed investigation

This PR changes 2 things:

  1. it adds a 100ms timeout for the request made by isKiteReachable. Though this didn't end up affecting performance, it fits semantically with what that method aims to represent. It could be plausibly be made shorter
  2. it gates the catch processing of the request processing based on the url path that's attempted to be reached. For paths that contain /clientapi/editor, we no longer perform the heretofore typical isKite<in-some-state> calls that entailed expensive OS calls that we blocking the return of a response (and thus causing lagginess).

fixes #14

In essence, in doing the failure processing for every event, completions, and signatures call, we were causing lag.

I attempted to be surgical here, and only restricted the processing for event, completions, and signatures calls, because they're the ones whose timings have by far the greatest effect on the user experience.

However, I think that this could stand more reworking, wrt where and when we ought to be performing these health checks. This seems like it would be something that would be more in the scope of a larger refactor of kite-connector and kite-api.

codecov-io commented 5 years ago

Codecov Report

:exclamation: No coverage uploaded for pull request base (master@8cb4e2c). Click here to learn what that means. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master      #16   +/-   ##
=========================================
  Coverage          ?   77.18%           
=========================================
  Files             ?       16           
  Lines             ?      596           
  Branches          ?        0           
=========================================
  Hits              ?      460           
  Misses            ?      136           
  Partials          ?        0
Impacted Files Coverage Δ
lib/index.js 83.82% <100%> (ø)
lib/utils.js 80% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 8cb4e2c...94c63d7. Read the comment docs.