Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix benign use of sync API (#3595) #3596

Merged
merged 1 commit into from
Dec 27, 2019

Conversation

tsondergaard
Copy link
Contributor

Running a program that uses knex with node --trace-sync-io results in
warnings such as this one:

(node:10232) WARNING: Detected use of sync API
    at randomBytes (internal/crypto/random.js:54:31)
    at nodeRNG ([...]/node_modules/uuid/lib/rng.js:7:17)
    at v4 ([...]/node_modules/uuid/v4.js:13:52)
    at toSQL ([...]/node_modules/knex/lib/query/compiler.js:73:28)
    at toSQL ([...]/node_modules/knex/lib/query/builder.js:77:44)
    at [...]/node_modules/knex/lib/runner.js:30:36
    at [...]/node_modules/knex/lib/runner.js:253:24
    at tryCatcher ([...]/node_modules/knex/node_modules/bluebird/js/release/util.js:16:23)
    at [...]/node_modules/knex/node_modules/bluebird/js/release/promise.js:547:31

uuid.v1() provides more than adequate collision guarantees, is 5 times
faster than uuid.v4() and most importantly do not trigger the warning
above.

Running a program that uses knex with node --trace-sync-io results in
warnings such as this one:

    (node:10232) WARNING: Detected use of sync API
        at randomBytes (internal/crypto/random.js:54:31)
        at nodeRNG ([...]/node_modules/uuid/lib/rng.js:7:17)
        at v4 ([...]/node_modules/uuid/v4.js:13:52)
        at toSQL ([...]/node_modules/knex/lib/query/compiler.js:73:28)
        at toSQL ([...]/node_modules/knex/lib/query/builder.js:77:44)
        at [...]/node_modules/knex/lib/runner.js:30:36
        at [...]/node_modules/knex/lib/runner.js:253:24
        at tryCatcher ([...]/node_modules/knex/node_modules/bluebird/js/release/util.js:16:23)
        at [...]/node_modules/knex/node_modules/bluebird/js/release/promise.js:547:31

uuid.v1() provides more than adequate collision guarantees, is 5 times
faster than uuid.v4() and most importantly do not trigger the warning
above.
@tsondergaard
Copy link
Contributor Author

#3595

@kibertoad kibertoad merged commit c277edb into knex:master Dec 27, 2019
@kibertoad
Copy link
Collaborator

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants