Gitlab Community Edition Instance

Commit 808f5d98 authored by mhellka's avatar mhellka
Browse files

Fix: Pool metrics check wrong file system.

parent f1a664e8
......@@ -72,7 +72,7 @@ public class NioPool implements StoragePool {
NioRecoveryHandler recoveryHandler;
LoadingCache<Path, JsonIndex> indexCache;
private PoolStats stats;
private final PoolStats stats;
public NioPool(Config cfg) throws IOException, ConfigException {
// TODO: Make more than just the path configurable
......@@ -351,28 +351,27 @@ public class NioPool implements StoragePool {
return indexCache.stats();
}
FileStore getFileStore() throws IOException {
Path target = basePath;
while (Files.isSymbolicLink(target))
target = Files.readSymbolicLink(target);
return Files.getFileStore(target);
}
public long getDiskTotal() {
long total = 0;
for (FileStore store : basePath.getFileSystem().getFileStores()) {
try {
total = store.getTotalSpace();
} catch (IOException e) {
continue;
}
try {
return getFileStore().getTotalSpace();
} catch (final IOException e) {
return -1;
}
return total;
}
public long getDiskFree() {
long usable = 0;
for (FileStore store : basePath.getFileSystem().getFileStores()) {
try {
usable = store.getUsableSpace();
} catch (IOException e) {
continue;
}
try {
return getFileStore().getUsableSpace();
} catch (final IOException e) {
return -1;
}
return usable;
}
public long cacheSize() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment