You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@gajus here's example test which reproduces the issue
test('parse long query', (t) => {
const params = [...Array(30_000).keys()].map(i => `$${i}`).join(', ')
const query = `
SELECT 1
FROM foo
WHERE id IN (
${params}
)
`
console.time('parse')
const subject = stripComments(query)
console.timeEnd('parse')
t.true(true);
})
npm test will output
> [email protected] test
> NODE_ENV=test nyc ava --verbose --serial
✔ factories › createQueryNormalisationInterceptor › strips comments from the query
✖ Timed out while running tests
parse: 24.216s
─
1 test passed
Ava test runner default timeout is 10s. I ran tests with macbook i9.
We did a CPU profiling for our node app and noticed that the query normalization blocks event loop for quite a while:
stripComments function was taking 12 seconds in one long SQL query we were using.
Wanted to report this for others possibly investigating the same, feel free to close. Unfortunately I don't have a reproducible query example.
The text was updated successfully, but these errors were encountered: