Analytics: Fix - Prevent multiple SDK initializations#2112
Open
cmgustavo wants to merge 1 commit intobitpay:developfrom
Open
Analytics: Fix - Prevent multiple SDK initializations#2112cmgustavo wants to merge 1 commit intobitpay:developfrom
cmgustavo wants to merge 1 commit intobitpay:developfrom
Conversation
800c771 to
81029c7
Compare
|
|
||
| return; | ||
| logManager.info('Successfully initialized analytics.'); | ||
| } finally { |
Collaborator
There was a problem hiding this comment.
let's add a catch here:
catch (err) {
const errMsg =
err instanceof Error ? err.message : JSON.stringify(err);
logManager.error(`[Analytics] init failed: ${errMsg}`);
}
Member
Author
There was a problem hiding this comment.
Not necessary since each individual SDK init has already try/catch in lines 98, 111, and 139.
| const flushQueue = () => { | ||
| const queue = _preInitQueue; | ||
| _preInitQueue = []; | ||
| queue.forEach(cb => cb()); |
Collaborator
There was a problem hiding this comment.
Let's add a catch here for the queue:
queue.forEach(cb => {
try {
cb();
} catch (err) {
const errMsg = err instanceof Error ? err.message : JSON.stringify(err);
logManager.error(`[Analytics] Error executing queued event: ${errMsg}`);
}
});
Member
Author
There was a problem hiding this comment.
It is only useful if it’s written to handle async rejections, not just sync exceptions
81029c7 to
e894f11
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
RN-2412
changes
initialize()will reuse the same promise