Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Raise request concurrency #426

Closed
radeksimko opened this issue Feb 25, 2021 · 1 comment · Fixed by #489
Closed

Raise request concurrency #426

radeksimko opened this issue Feb 25, 2021 · 1 comment · Fixed by #489
Labels
bug Something isn't working

Comments

@radeksimko
Copy link
Member

radeksimko commented Feb 25, 2021

Request concurrency is required in certain scenarios:

  • request cancellation Fix request cancellation #314
  • publishing diagnostics directly from the handler (we're currently working around the limitation by publishing in a separate routine
    go n.notify()
    return n
    }
    // PublishHCLDiags accepts a map of hcl diagnostics per file and queues them for publishing.
    // A dir path is passed which is joined with the filename keys of the map, to form a file URI.
    // A source string is passed and set for each diagnostic, this is typically displayed in the client UI.
    func (n *Notifier) PublishHCLDiags(ctx context.Context, dirPath string, diags map[string]hcl.Diagnostics, source string) {
    select {
    case <-n.sessCtx.Done():
    n.closeDiagsOnce.Do(func() {
    close(n.diags)
    })
    return
    default:
    }
    for filename, ds := range diags {
    n.diags <- diagContext{
    ctx: ctx, source: source,
    diags: ilsp.HCLDiagsToLSP(ds, source),
    uri: lsp.DocumentURI(uri.FromPath(filepath.Join(dirPath, filename))),
    }
    }
    }
    func (n *Notifier) notify() {
    for d := range n.diags {
    if err := jrpc2.PushNotify(d.ctx, "textDocument/publishDiagnostics", lsp.PublishDiagnosticsParams{
    URI: d.uri,
    Diagnostics: n.mergeDiags(d.uri, d.source, d.diags),
    }); err != nil {
    n.logger.Printf("Error pushing diagnostics: %s", err)
    }
    }
    }
    )
  • reporting progress Report progress for indexing operations #5 Report progress when obtaining schema #150 directly from handlers

We can attempt to reverse #120 - i.e. increase concurrency.

Before doing that though it would be very useful to add some telemetry to be able to tell whether requests are still getting received and responded to in the right order. We can leverage the native telemetry/event method of LSP, and/or just log this on the VS Code extension side only.

Related: creachadair/jrpc2#43

@radeksimko radeksimko added the bug Something isn't working label Feb 25, 2021
@radeksimko radeksimko changed the title Raise request concurrency & add telemetry Raise request concurrency May 4, 2021
@github-actions
Copy link

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems similar to this, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant