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

Old working directories are not removed #76

Open
TovarischZhukov opened this issue Sep 28, 2021 · 2 comments
Open

Old working directories are not removed #76

TovarischZhukov opened this issue Sep 28, 2021 · 2 comments

Comments

@TovarischZhukov
Copy link

  1. When a working directory is created, it is created outside the parent directory.

if (builderDataDirectory == null) { builderDataDirectory = Files.createTempDirectory("epg").toFile(); }

But at the moment when a search is performed for obsolete ones, their path is calculated relative to the parent.

private void cleanOldDataDirectories(File parentDirectory) { final File[] children = parentDirectory.listFiles();

  1. If we still find such a directory, we try to take the lock, but without releasing it, we delete the folder, an exception occurs

try (FileOutputStream fos = new FileOutputStream(lockFile); FileLock lock = fos.getChannel().tryLock()) { if (lock != null) { //..... FileUtils.deleteDirectory(dir); } }

  1. Sometimes, when the test ends abnormally, the "epg-lock" file is not created, so these folders are also not cleared during subsequent runs.

final File lockFile = new File(dir, LOCK_FILE_NAME); final boolean isTooNew = System.currentTimeMillis() - lockFile.lastModified() < 10 * 60 * 1000; if (!lockFile.exists() || isTooNew) { continue; }

@rasharab
Copy link

rasharab commented Apr 21, 2023

Just noticed this today as well.
I can attempt to fix this if you'd like?

@tomix26
Copy link
Collaborator

tomix26 commented May 15, 2023

If you have an idea how to fix it, help is always welcome.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants