Skip to content

Commit

Permalink
fix: use cTimeMs instead of birthtime due to EFS (#1035)
Browse files Browse the repository at this point in the history
  • Loading branch information
dcshzj authored Nov 14, 2023
1 parent 54b44c1 commit c74ee84
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/services/db/GitFileSystemService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -858,7 +858,7 @@ export default class GitFileSystemService {
mediaUrl: `${dataUrlPrefix},${file.content}`,
mediaPath: `${directoryName}/${fileName}`,
type: fileType,
addedTime: stats.birthtimeMs,
addedTime: stats.ctimeMs,
size: stats.size,
})
})
Expand Down Expand Up @@ -929,7 +929,7 @@ export default class GitFileSystemService {
sha,
path,
size: type === "dir" ? 0 : stats.size,
addedTime: stats.birthtimeMs,
addedTime: stats.ctimeMs,
}

return okAsync(result)
Expand Down
14 changes: 7 additions & 7 deletions src/services/db/__tests__/GitFileSystemService.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ describe("GitFileSystemService", () => {
path: "fake-dir",
size: 0,
addedTime: fs.statSync(`${EFS_VOL_PATH_STAGING}/fake-repo/fake-dir`)
.birthtimeMs,
.ctimeMs,
}
const expectedAnotherFakeDir: GitDirectoryItem = {
name: "another-fake-dir",
Expand All @@ -101,7 +101,7 @@ describe("GitFileSystemService", () => {
size: 0,
addedTime: fs.statSync(
`${EFS_VOL_PATH_STAGING}/fake-repo/another-fake-dir`
).birthtimeMs,
).ctimeMs,
}
const expectedFakeEmptyDir: GitDirectoryItem = {
name: "fake-empty-dir",
Expand All @@ -111,7 +111,7 @@ describe("GitFileSystemService", () => {
size: 0,
addedTime: fs.statSync(
`${EFS_VOL_PATH_STAGING}/fake-repo/fake-empty-dir`
).birthtimeMs,
).ctimeMs,
}
const expectedAnotherFakeFile: GitDirectoryItem = {
name: "another-fake-file",
Expand All @@ -121,7 +121,7 @@ describe("GitFileSystemService", () => {
size: "Another fake content".length,
addedTime: fs.statSync(
`${EFS_VOL_PATH_STAGING}/fake-repo/another-fake-file`
).birthtimeMs,
).ctimeMs,
}

const result = await GitFileSystemService.listDirectoryContents(
Expand Down Expand Up @@ -162,7 +162,7 @@ describe("GitFileSystemService", () => {
path: "fake-dir",
size: 0,
addedTime: fs.statSync(`${EFS_VOL_PATH_STAGING}/fake-repo/fake-dir`)
.birthtimeMs,
.ctimeMs,
}
const expectedAnotherFakeFile: GitDirectoryItem = {
name: "another-fake-file",
Expand All @@ -172,7 +172,7 @@ describe("GitFileSystemService", () => {
size: "Another fake content".length,
addedTime: fs.statSync(
`${EFS_VOL_PATH_STAGING}/fake-repo/another-fake-file`
).birthtimeMs,
).ctimeMs,
}

const result = await GitFileSystemService.listDirectoryContents(
Expand Down Expand Up @@ -1429,7 +1429,7 @@ describe("GitFileSystemService", () => {
).toString("base64")}`,
mediaPath: "fake-dir/fake-media-file.png",
type: "file",
addedTime: fileStats.birthtimeMs,
addedTime: fileStats.ctimeMs,
size: fileStats.size,
}

Expand Down

0 comments on commit c74ee84

Please sign in to comment.