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

tsondergaard commented Dec 27, 2019

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

This comment has been minimized.

Copy link
Contributor Author

tsondergaard commented Dec 27, 2019

@kibertoad kibertoad merged commit c277edb into knex:master Dec 27, 2019
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@kibertoad

This comment has been minimized.

Copy link
Collaborator

kibertoad commented Dec 27, 2019

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.