Skip to content

Commit 1e94f53

Browse files
committed
fix: Remove hdd-space
We’re only supporting v18+ on v5
1 parent a626573 commit 1e94f53

File tree

4 files changed

+3
-164
lines changed

4 files changed

+3
-164
lines changed

dependencies.md

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -112,13 +112,6 @@ Generally, dependencies are added by simply adding them to the dependencies list
112112
- Can be deferred: Potentially, we could load it on-demand
113113
- Eventual removal: Yes, once node crypto adds native support for argon2
114114

115-
## hdd-space
116-
117-
- Need for usage: Used to check for sufficient disk space on Node v16. Runs `df`. Should _only_ run on Node v16.
118-
- Size: 387KB
119-
- Security: No known issues.
120-
- Eventual removal: As soon as we can drop Node v16 support, we should _immediately_ remove this dependency. It is not needed on Node v18+.
121-
122115
## chokidar
123116

124117
- Need for usage: Reliable file watching. This is the industry standard file watcher and deals with the many edge cases that node.js's watch (file replacement and changing inode for example) and watchFile (nothing but a terrible poller on a timer) don't handle well.

package-lock.json

Lines changed: 0 additions & 141 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,6 @@
236236
},
237237
"optionalDependencies": {
238238
"bufferutil": "^4.0.9",
239-
"hdd-space": "^1.2.0",
240239
"segfault-handler": "^1.3.0",
241240
"utf-8-validate": "^5.0.10"
242241
}

server/storageReclamation.ts

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const RECLAMATION_INTERVAL = convertToMS(envMgr.get(CONFIG_PARAMS.STORAGE_RECLAM
1919
* a priority of 0.
2020
* @param path
2121
* @param handler
22+
* @param skipThreadCheck
2223
*/
2324
export function onStorageReclamation(
2425
path: string,
@@ -39,21 +40,8 @@ export function onStorageReclamation(
3940
}
4041
let reclamationTimer: NodeJS.Timeout;
4142
const defaultGetAvailableSpaceRatio = async (path: string): Promise<number> => {
42-
if (statfs) {
43-
const fsStats = await statfs(path);
44-
return fsStats.bavail / fsStats.blocks;
45-
} else {
46-
return new Promise((resolve) => {
47-
import('hdd-space').then((hddSpace) => {
48-
hddSpace.default((space: any) => {
49-
for (const volume of space.parts) {
50-
if (path.startsWith(volume.place)) return resolve(volume.free / volume.size);
51-
}
52-
return resolve(1);
53-
});
54-
});
55-
});
56-
}
43+
const fsStats = await statfs(path);
44+
return fsStats.bavail / fsStats.blocks;
5745
};
5846
let getAvailableSpaceRatio: (path: string) => Promise<number> = defaultGetAvailableSpaceRatio;
5947

0 commit comments

Comments
 (0)