Don't attempt to cleanup the filesystem if a build is in progress.

This isn't essential but it helps to reduce unnecessary load and processing which would be better spent on building.
This commit is contained in:
CalDescent 2021-08-20 20:19:51 +01:00
parent b2c0915a71
commit fd795b4361
3 changed files with 18 additions and 1 deletions

View File

@ -129,12 +129,13 @@ public class ArbitraryDataReader {
}
private void preExecute() {
ArbitraryDataManager.getInstance().setBuildInProgress(true);
this.createWorkingDirectory();
this.createUncompressedDirectory();
}
private void postExecute() {
ArbitraryDataManager.getInstance().setBuildInProgress(false);
}
private void createWorkingDirectory() {

View File

@ -106,6 +106,11 @@ public class ArbitraryDataCleanupManager extends Thread {
continue;
}
// Don't interfere with the filesystem whilst a build is in progress
if (ArbitraryDataManager.getInstance().getBuildInProgress()) {
Thread.sleep(5000);
}
// Fetch the transaction data
ArbitraryTransactionData arbitraryTransactionData = ArbitraryTransactionUtils.fetchTransactionData(repository, signature);

View File

@ -36,6 +36,8 @@ public class ArbitraryDataManager extends Thread {
private static ArbitraryDataManager instance;
private boolean buildInProgress = false;
private volatile boolean isStopping = false;
@ -411,6 +413,15 @@ public class ArbitraryDataManager extends Thread {
}
public void setBuildInProgress(boolean buildInProgress) {
this.buildInProgress = buildInProgress;
}
public boolean getBuildInProgress() {
return this.buildInProgress;
}
// Network handlers
public void onNetworkGetArbitraryDataMessage(Peer peer, Message message) {