-
Notifications
You must be signed in to change notification settings - Fork 1
chore: defer machine ID resolution #161
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
base: main
Are you sure you want to change the base?
Conversation
private readonly eventCache: EventCache | ||
) {} | ||
|
||
static create( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while this is not asyncronous. I'm using create(...)
to make it clear there are associated side effects
f9ba638
to
2eb44fb
Compare
b78be48
to
9be3e12
Compare
5ae2584
to
5348a3a
Compare
af9631b
to
c869d63
Compare
This has revealed a very major problem with our Build vs Jest setup targetting entirely different module resolutions... Unfortunately I can't think of a good solution... |
We did not have a full ESM configuration for jest and therefore had a discrepancy between our build vs test. This discrepancy leads to issues with CommonJS modules.
…rver into gagik/use-machine-id
…gagik/use-machine-id
@@ -76,8 +76,6 @@ export function setupMongoDBIntegrationTest(): MongoDBIntegrationTest { | |||
let dbsDir = path.join(tmpDir, "mongodb-runner", "dbs"); | |||
for (let i = 0; i < 10; i++) { | |||
try { | |||
// TODO: Fix this type once mongodb-runner is updated. | |||
// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-call |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
drive-by
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comments from me. I wonder if we should split it into 2 - one PR that just replaces native-machine-id with node-machine-id, which should hopefully be a drop-in replacement, then another one that does the deferred telemetry initialization.
resolve!: (value: T) => void; | ||
reject!: (reason: unknown) => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need the assertions here?
resolve!: (value: T) => void; | |
reject!: (reason: unknown) => void; | |
resolve: (value: T) => void; | |
reject: (reason: unknown) => void; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, this is more of a late intialization assertion. typescript isn't smart enough to understand they're being set in the constructor
Fixes #122
This defers the device ID resolution and add a timeout for resolution. Buffers events in the meantime.