Conversation
Bundles Sizes Evolution
🚀 CPU Performance
🧠 Memory Performance
|
|
dc49dab to
cf26f2b
Compare
7b107f7 to
6e0e1f7
Compare
| function check() { | ||
| try { | ||
| const result = callback() | ||
| if (result && typeof (result as any).then === 'function') { | ||
| ;(result as Promise<T>).then(handleResult, handleError) | ||
| } else { | ||
| handleResult(result as T) | ||
| } | ||
| } catch (error) { | ||
| handleError(error as Error) | ||
| } | ||
| } |
There was a problem hiding this comment.
suggestion: you can simplify all this as:
function check() {
Promise.resolve().then(callback).then(handleResult, handleError)
}And sometimes in the future:
function check() {
Promise.try(callback).then(handleResult, handleError)
}| beforeEach(async () => { | ||
| LOGS = makeLogsPublicApi(startLogs) | ||
| LOGS.init(DEFAULT_INIT_CONFIGURATION) | ||
| await waitFor(() => startLogs.calls.count() > 0) |
There was a problem hiding this comment.
question: not sure to understand why you put waitFor in many places. When I remove those waitFor, tests are still passing?
Also suggestion: use collectAsyncCalls instead of waitFor (it'll be more efficient)
await collectAsyncCalls(startLogs, 1)There was a problem hiding this comment.
It was super flaky for me. Most of the time, it varies between 3 or 25 tests failing. So I chose to add waitFor everywhere.
| // acquire lock | ||
| currentLock = createLock() | ||
| persistWithLock(currentStore.session) | ||
| safePersist(() => persistWithLock(currentStore.session)) |
There was a problem hiding this comment.
question: Why do we need this change?
There was a problem hiding this comment.
I noticed that the session manager inits before the tryInit, so it outside of the monitor call.
Motivation
The Session Manager Revamp (SMR) will require our session manager to operate asynchronously and postpone the SDK initialization until the session is ready.
Changes
onReadycallback in session manager that propagates through all places using the start of the session.Test instructions
TBD
Checklist