theme-tools icon indicating copy to clipboard operation
theme-tools copied to clipboard

docs-updater should race against a timeout or else starting the language server hangs.

Open charlespwd opened this issue 1 year ago • 2 comments

Describe the bug The VS Code extension hangs if you start it with Wifi down (happened to me during storms last week). It hangs because theme-docs-updater attempts to download latest.json from theme-liquid-docs and it doesn't timeout (or the timeout is long).

We should do something more along the lines of "wait at most 5s and otherwise go with what is on disk".

Something like this:

const timeout = (ms: number) => new Promise((_, reject) => setTimeout(reject, ms));

  /**
   * The setup method checks that the latest revision matches the one from
   * Shopify/theme-liquid-docs. If there's a diff in revision, it means
   * that the documentations that you have locally are out of date.
   *
   * The setup method then downloads the other files.
   */
  setup = memo(async (): Promise<void> => {
    if (!(await exists(root))) {
      await fs.mkdir(root, { recursive: true });
    }

    const local = await this.latestRevision();
    try {
      await Promise.race([download('latest'), timeout(2000)]);
      const remote = await this.latestRevision();
      if (local !== remote) {
        await Promise.all(Resources.map((resource) => download(resource)));
      }
    } catch (_) {
      // we're offline...
    }
  });

charlespwd avatar Aug 14 '23 12:08 charlespwd

You have created a Bug without a Severity label of the format SEV-X.

It is important for Bugs to be correctly labeled and categorized so we have better visibility over our development health practices and make sure we are prioritizing the right investments.

The untriaged label has been added. Please remove it once the team has set the correct severity for this bug.

Learn more in this Vault Page.

services-db[bot] avatar Aug 14 '23 12:08 services-db[bot]

Terribly low value. You need to lose wifi connection between downloading the extension and then using it.

I'm going to assume that since you were able to download the extension, you are able to download the docs.

charlespwd avatar Sep 20 '23 13:09 charlespwd

get rate limited sometimes because of volume of requests to theme liquid docs

mgmanzella avatar Oct 17 '24 19:10 mgmanzella