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

fix: remove the Indexing progress message when exeption in withHieDb #3610

Merged
merged 3 commits into from
Jun 2, 2023

Conversation

guibou
Copy link
Collaborator

@guibou guibou commented May 28, 2023

If any exception was happening in withHieDb, the post action was never called, leading to a stale Indexing message in the client.

By using bracket, we ensure that the post message is called in the event of an exception, cleaning the confusing message in the client.

It does not change the well behaving of the indexing (i.e. if it was crashing, it is still crashing), but at least user won't be confused by a stale Indexing message.

See #2931 for an example when an exception can happen during the indexing.

@guibou guibou requested a review from pepeiborra as a code owner May 28, 2023 11:12
@guibou
Copy link
Collaborator Author

guibou commented May 28, 2023

I tried this code for one week at work (super large haskell codebase (hls takes 3 to 5 minutes to start), 2k+ modules, 20 devs) and the stuck Indexing message does not appears anymore.

Copy link
Collaborator

@fendor fendor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

What do you think about adding your reasoning to the code here?

ghcide/src/Development/IDE/Core/Compile.hs Outdated Show resolved Hide resolved
Copy link
Collaborator

@wz1000 wz1000 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This seems like a good idea

If any exception was happening in `withHieDb`, the `post` action was
never called, leading to a stale `Indexing` message in the client.

By using `bracket`, we ensure that the `post` message is called in the
event of an exception, cleaning the confusing message in the client.

It does not change the well behaving of the indexing (i.e. if it was
crashing, it is still crashing), but at least user won't be confused by
a stale `Indexing` message.
@guibou guibou force-pushed the fix_indexing_message_progress branch from 9014f48 to beffb29 Compare May 28, 2023 12:23
@guibou
Copy link
Collaborator Author

guibou commented May 28, 2023

LGTM!

What do you think about adding your reasoning to the code here?

I've added a comment.

@guibou guibou requested a review from fendor May 28, 2023 12:25
Copy link
Collaborator

@fendor fendor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM :)

@michaelpj michaelpj enabled auto-merge (squash) June 1, 2023 15:33
@michaelpj michaelpj merged commit 50efbbb into master Jun 2, 2023
smunix pushed a commit to smunix/haskell-language-server that referenced this pull request Jun 10, 2023
haskell#3610)

If any exception was happening in `withHieDb`, the `post` action was
never called, leading to a stale `Indexing` message in the client.

By using `bracket`, we ensure that the `post` message is called in the
event of an exception, cleaning the confusing message in the client.

It does not change the well behaving of the indexing (i.e. if it was
crashing, it is still crashing), but at least user won't be confused by
a stale `Indexing` message.

Co-authored-by: Michael Peyton Jones <me@michaelpj.com>
@fendor fendor mentioned this pull request Aug 8, 2023
19 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants