Skip to content

Commit

Permalink
Fix incorrect timeout removal in xdm/register.cjs
Browse files Browse the repository at this point in the history
  • Loading branch information
wooorm committed Sep 27, 2021
1 parent 7a92b18 commit 5c3d451
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions lib/integration/require.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,7 @@ function load(filePath, callback) {

// Sometimes, the import hangs (see error message for reasons).
// To fix that, a timeout can be used.
// However, setting a timeout, results in `deasync` waiting for it, even
// in cases where the import is already settled!
// That’s why this number is pretty low.
setTimeout(timeout, 192)
const id = setTimeout(timeout, 1024)

function timeout() {
done(
Expand All @@ -67,7 +64,7 @@ function load(filePath, callback) {
function done(error, result) {
if (called) return
called = true
clearTimeout(timeout)
clearTimeout(id)
callback(error, result)
}
}

0 comments on commit 5c3d451

Please sign in to comment.