Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(server): storage cleanup no longer counts hardlinked files as recovered space #17910

Mergedtris203(GitHub profile, opens in a new tab)merged 2 commits intomain fromrefs/pull/17910/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 78 additions and 15 deletions.

x
0 of 2 viewed, 2 left
70 additions and 13 deletionsapps/server/src/storageCleanup.test.tsModified
View file
@@ -5,6 +5,7 @@
import * as Fiber from "effect/Fiber";
import * as FileSystem from "effect/FileSystem";
import * as Layer from "effect/Layer";
+import * as Option from "effect/Option";
import type * as Path from "effect/Path";
import type * as Scope from "effect/Scope";
import * as Stream from "effect/Stream";
@@ -236,6 +237,16 @@
});
});
​
+const allocatedBytes = (fs: FileSystem.FileSystem, file: string) =>
+ fs.stat(file).pipe(
+ Effect.map((stat) =>
+ Option.getOrElse(
+ Option.map(stat.blocks, (blocks) => Number(blocks) * 512),
+ () => Number(stat.size),
+ ),
+ ),
+ );
+​
const cleanupFixture = (
storageCleanup: StorageCleanupSettings = {
...DEFAULT_SERVER_SETTINGS.storageCleanup,
@@ -811,6 +822,7 @@
orphan = `${fixture.config.worktreesDir}/repository/orphan`;
yield* fs.makeDirectory(orphan, { recursive: true });