Skip to content

Commit

Permalink
chore: increase debounces of dev script
Browse files Browse the repository at this point in the history
  • Loading branch information
Julusian committed Oct 2, 2024
1 parent cb53297 commit 3fccb97
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions tools/dev.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ if (!fs.existsSync('../webui/build')) {
console.warn('Skipping webui build, you may need to run `yarn dist:webui` if changes have been made recently')
}

console.log('Starting application')
console.log('Starting typescript watchers')

concurrently([
{
Expand Down Expand Up @@ -127,7 +127,7 @@ chokidar
{
after: true,
before: false,
wait: 100,
wait: 1000,
}
)
cachedDebounces[moduleDirName] = fn
Expand All @@ -148,8 +148,11 @@ async function start() {
})
}

let canStart = false
const restart = debounceFn(
() => {
if (!canStart) return

if (node) {
// Check if process has already exited
if (node.exitCode !== null) node = null
Expand Down Expand Up @@ -177,7 +180,7 @@ const restart = debounceFn(
{
after: true,
before: false,
wait: 100,
wait: 1000,
}
)

Expand All @@ -191,4 +194,9 @@ process.on('SIGTERM', signalHandler)
process.on('SIGQUIT', signalHandler)

// Trigger a start soon
setTimeout(() => restart(), 5000)
setTimeout(() => {
console.log('Starting application')
canStart = true

restart()
}, 3000)

0 comments on commit 3fccb97

Please sign in to comment.