Skip to content

files - add new option atomic for writeFile and adopt for state (fix #180695)#182270

Closed
bpasero wants to merge 2 commits into
mainfrom
ben/atomic-writes
Closed

files - add new option atomic for writeFile and adopt for state (fix #180695)#182270
bpasero wants to merge 2 commits into
mainfrom
ben/atomic-writes

Conversation

@bpasero

@bpasero bpasero commented May 12, 2023

Copy link
Copy Markdown
Contributor

@sandy081 would be happy if you could check if the implementation makes sense

//cc @alexdima this adds the most basic atomic write to the file service (behind an option) which is:

  • write to a file <resource path>.vsctmp in the same folder
  • move the file to <resource path>
  • skip our internal events and only send a single event (as we would have it without atomic writes)

Some notes:

  • this will actually work with any file system provider because it leverages existing capabilities [1]
  • some external file watchers maybe confused (I think thats ok, our watcher should be fine)
  • when process dies, we risk to keep .vsctmp files laying around (I think thats ok too, because its never acumulating, its always the same tmp file)

[1] we could consider making this a capability and move this into the provider itself to do the write and move one after the other without going over processes, but I think it does not change the aspects of it much.

@bpasero bpasero enabled auto-merge (squash) May 12, 2023 07:46
@bpasero bpasero requested a review from sandy081 May 12, 2023 07:47
@vscodenpa vscodenpa added this to the May 2023 milestone May 12, 2023
@bpasero bpasero removed the request for review from sandy081 May 19, 2023 16:13
@bpasero bpasero removed this from the May 2023 milestone May 19, 2023
@sandy081 sandy081 self-requested a review May 23, 2023 14:22
@bpasero bpasero closed this May 24, 2023
auto-merge was automatically disabled May 24, 2023 15:52

Pull request was closed

@bpasero

bpasero commented May 24, 2023

Copy link
Copy Markdown
Contributor Author

Will continue in a new PR that does what #182974 talks about if possible.

@bpasero bpasero deleted the ben/atomic-writes branch May 24, 2023 16:05
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 8, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants