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

terraform/module: Avoid running a job if nothing has changed #1002

Closed
10 tasks
radeksimko opened this issue Jul 18, 2022 · 1 comment · Fixed by #1006
Closed
10 tasks

terraform/module: Avoid running a job if nothing has changed #1002

radeksimko opened this issue Jul 18, 2022 · 1 comment · Fixed by #1006
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@radeksimko
Copy link
Member

Background

This is a different approach to addressing a performance bottleneck when we have duplicate jobs, as originally described in #989

Proposal

Remove deduplication logic from the scheduler:

jobID, queued, err := js.jobExists(newJob, StateQueued)
if err != nil {
return "", err
}
if queued {
return jobID, nil
}
jobID, running, err := js.jobExists(newJob, StateRunning)
if err != nil {
return "", err
}
if running {
return jobID, nil
}

Introduce IgnoreExistingState bool to job.Job{}, to indicate whether to ignore existing data/cache.

  • initialize - IgnoreExistingState: false
  • textDocument/didOpen - IgnoreExistingState: true - this is only necessary to account for an edge case where the user opens editor with unsaved files from previous session, we could potentially avoid it if we tracked ModTime or any kind of indicator allowing us to compare the file being opened with the one already indexed, effectively implementing this TODO
  • textDocument/didChange - IgnoreExistingState: true
  • workspace/didChangeWorkspaceFolders - IgnoreExistingState: true
  • workspace/didChangeWatchedFiles - IgnoreExistingState: true

The job could return return an error, such as NotChangedError{Handle: document.DirHandle}, such that downstream jobs can decide based on that, whether to run.

Implementation Notes

Regarding NotChangedError - some downstream jobs run after multiple different jobs, so we need to make sure that the upstream job actually returns NotChangedError if and only if all jobs detect no changes.

@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 Sep 10, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant