Skip to content

Old working directories are not removed #76

Description

@TovarischZhukov
  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; }

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions