Skip to content

Ensure file change notification is executed after file change is done#5511

Merged
JanKrivanek merged 4 commits intodotnet:mainfrom
GangWang01:stabilize-searchcache
Nov 3, 2022
Merged

Ensure file change notification is executed after file change is done#5511
JanKrivanek merged 4 commits intodotnet:mainfrom
GangWang01:stabilize-searchcache

Conversation

@GangWang01
Copy link
Member

Problem

#5344 - In GlobalSettings file change notification might be announced while the file is still in progress of being changed.

Solution

Ensure file change notification is executed after file change is done. It could resolve the test issue: in Microsoft.TemplateEngine.Edge.UnitTests.TestFileWatcher while settings.json file is still being written, reading the file fails within the retries and then the IOException is thrown out.

Checks:

  • Added unit tests
  • Added #nullable enable to all the modified files ?

Copy link
Member

@JanKrivanek JanKrivanek left a comment

Choose a reason for hiding this comment

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

It looks good. Though I think we need to be carefull about possible cumulation of Tasks waiting to acquire the lock

@JanKrivanek JanKrivanek marked this pull request as ready for review November 2, 2022 09:25
@JanKrivanek JanKrivanek requested a review from a team as a code owner November 2, 2022 09:25
@JanKrivanek JanKrivanek requested review from JanKrivanek and removed request for JanKrivanek November 2, 2022 09:38
Copy link
Member

@vlada-shubina vlada-shubina left a comment

Choose a reason for hiding this comment

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

Looks good for the purpose, only localization should be added.

Also consider filing the issue to improve the handling of duplicate events as SettingsChanged will trigger long-running rescan.

@JanKrivanek JanKrivanek merged commit 350cf99 into dotnet:main Nov 3, 2022
@JanKrivanek
Copy link
Member

/port to release/7.0.2xx

@JanKrivanek
Copy link
Member

/backport to release/7.0.2xx

@github-actions
Copy link
Contributor

github-actions bot commented Nov 3, 2022

Started backporting to release/7.0.2xx: https://github.com/dotnet/templating/actions/runs/3387139418

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.

3 participants