Skip to content

Commit e8d7095

Browse files
committed
feat: add 5 min buffer for source & target git last time comparision
1 parent 84899b3 commit e8d7095

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

packages/translate/src/utils.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,14 @@ export async function getDocUpdateStatus({
9595
);
9696

9797
logger.debug(
98-
`${sourcePath}: sourceLastModifiedDate ${sourceLastModifiedDate.toISOString()}, meta[translation-updated-at] ${metadataTranslationUpdatedAt.toISOString()}`,
98+
`${sourcePath}: source's lastModifiedDate ${sourceLastModifiedDate.toISOString()}, target.meta[translation-updated-at] ${metadataTranslationUpdatedAt.toISOString()}`,
9999
);
100-
// If the source file has been updated since the last translation
101-
if (sourceLastModifiedDate > metadataTranslationUpdatedAt) {
100+
// If the source file has been updated since the last translation plus 5 minutes
101+
// (to account for any potential delays in git log updates), it needs to be updated
102+
if (
103+
sourceLastModifiedDate.getTime() >
104+
metadataTranslationUpdatedAt.getTime() + 5 * 60 * 1000
105+
) {
102106
logger.debug(
103107
`Source file ${sourcePath} has been updated since last translation, needs updating`,
104108
);

0 commit comments

Comments
 (0)