produzione 1 #9
@@ -11,6 +11,7 @@ import java.io.IOException;
|
|||||||
import java.nio.file.Files;
|
import java.nio.file.Files;
|
||||||
import java.nio.file.Path;
|
import java.nio.file.Path;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Comparator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
@@ -135,12 +136,25 @@ public class SlicerService {
|
|||||||
Thread.currentThread().interrupt();
|
Thread.currentThread().interrupt();
|
||||||
throw new IOException("Interrupted during slicing", e);
|
throw new IOException("Interrupted during slicing", e);
|
||||||
} finally {
|
} finally {
|
||||||
// Cleanup temp dir
|
deleteRecursively(tempDir);
|
||||||
// In production we should delete, for debugging we might want to keep?
|
}
|
||||||
// Let's delete for now on success.
|
}
|
||||||
// recursiveDelete(tempDir);
|
|
||||||
// Leaving it effectively "leaks" temp, but safer for persistent debugging?
|
private void deleteRecursively(Path path) {
|
||||||
// Implementation detail: Use a utility to clean up.
|
if (path == null || !Files.exists(path)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
try (var walk = Files.walk(path)) {
|
||||||
|
walk.sorted(Comparator.reverseOrder()).forEach(p -> {
|
||||||
|
try {
|
||||||
|
Files.deleteIfExists(p);
|
||||||
|
} catch (IOException e) {
|
||||||
|
logger.warning("Failed to delete temp path " + p + ": " + e.getMessage());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
} catch (IOException e) {
|
||||||
|
logger.warning("Failed to walk temp directory " + path + ": " + e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ services:
|
|||||||
container_name: print-calculator-backend-${ENV}
|
container_name: print-calculator-backend-${ENV}
|
||||||
ports:
|
ports:
|
||||||
- "${BACKEND_PORT}:8000"
|
- "${BACKEND_PORT}:8000"
|
||||||
env_file:
|
|
||||||
- .env
|
|
||||||
environment:
|
environment:
|
||||||
- DB_URL=${DB_URL}
|
- DB_URL=${DB_URL}
|
||||||
- DB_USERNAME=${DB_USERNAME}
|
- DB_USERNAME=${DB_USERNAME}
|
||||||
@@ -20,6 +18,7 @@ services:
|
|||||||
- backend_profiles_${ENV}:/app/profiles
|
- backend_profiles_${ENV}:/app/profiles
|
||||||
- /mnt/cache/appdata/print-calculator/${ENV}/storage_quotes:/app/storage_quotes
|
- /mnt/cache/appdata/print-calculator/${ENV}/storage_quotes:/app/storage_quotes
|
||||||
- /mnt/cache/appdata/print-calculator/${ENV}/storage_orders:/app/storage_orders
|
- /mnt/cache/appdata/print-calculator/${ENV}/storage_orders:/app/storage_orders
|
||||||
|
- /mnt/cache/appdata/print-calculator/${ENV}/storage_requests:/app/storage_requests
|
||||||
|
|
||||||
|
|
||||||
frontend:
|
frontend:
|
||||||
|
|||||||
Reference in New Issue
Block a user