utils icon indicating copy to clipboard operation
utils copied to clipboard

Delete: During the deletion of a folder, additional files may be added.

Open janbarasek opened this issue 3 years ago • 5 comments

  • bug fix
  • BC break? yes

New files may be created by another process while the directory is being deleted. The deletion will then fail. The new implementation repeatedly checks the files in the directory.

Demo:

Snímek obrazovky 2022-01-31 v 13 22 31 Snímek obrazovky 2022-01-31 v 13 32 52

Thanks.

janbarasek avatar Jan 31 '22 12:01 janbarasek

The error seems expected. You simply cannot delete a directory that is actively being written into.

JanTvrdik avatar Jan 31 '22 12:01 JanTvrdik

This means that, for example, the cache can never be removed if there are many parallel requests to the application.

How to safely delete the cache contents if there is an error?

For example, the rm -fr temp/cache/* command will always delete the contents safely and not cause an error to be thrown, like Nette.

janbarasek avatar Jan 31 '22 13:01 janbarasek

This means that, for example, the cache can never be removed if there are many parallel requests to the application.

You can remove individual files, just not the directory itself.

JanTvrdik avatar Jan 31 '22 15:01 JanTvrdik

For example, the rm -fr temp/cache/* command will always delete the contents safely and not cause an error to be thrown, like Nette.

That's because of -f option. It only mutes errors. Try -r only on rush directory. You get Directory not empty.

milo avatar Jan 31 '22 15:01 milo

So could Nette implement a force switch? There are certainly valid cases where this is useful.

janbarasek avatar Jan 31 '22 16:01 janbarasek