File tree 1 file changed +8
-0
lines changed
1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ import { formatChoices } from '../core/utils.js'
6
6
import { parentPort } from 'node:worker_threads'
7
7
import { type Stamp , getScriptsDb , getTimestamps } from '../core/db.js'
8
8
import { scriptsSort } from '../core/utils.js'
9
+ import { stat } from 'node:fs/promises'
9
10
10
11
// --------------------
11
12
// Logging to Parent
@@ -46,6 +47,13 @@ const updateTimestampsDb = async (stamp: Stamp) => {
46
47
return null
47
48
}
48
49
50
+ // Get file stats. Make sure it has changed in the last 30 seconds
51
+ const fileStats = await stat ( stamp . filePath )
52
+ if ( fileStats . mtime . getTime ( ) < Date . now ( ) - 30000 ) {
53
+ logToParent ( `File has not changed in the last 30 seconds: ${ stamp . filePath } ` )
54
+ return null
55
+ }
56
+
49
57
const originalFilePath = stamp . filePath
50
58
const timestampsDb = await getTimestamps ( )
51
59
const index = timestampsDb . stamps . findIndex ( ( s ) => s . filePath === originalFilePath )
You can’t perform that action at this time.
0 commit comments