-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
chore(core): enable eslint and remove tslint #12982
Conversation
let inflightPromise: Promise<R> | undefined; | ||
|
||
return async (...args: A): Promise<Awaited<R>> => { | ||
return async (...args: A): Promise<R> => { | ||
if (inflightPromise) return inflightPromise; | ||
|
||
inflightPromise = new Promise(async (resolve, reject) => { | ||
try { | ||
const result = await asyncFunction(...args); | ||
resolve(result); | ||
} catch (error) { | ||
reject(error); | ||
} finally { | ||
inflightPromise = undefined; | ||
} | ||
inflightPromise = new Promise<R>((resolve, reject) => { | ||
asyncFunction(...args) | ||
.then(result => { | ||
resolve(result); | ||
}) | ||
.catch(error => { | ||
reject(error); | ||
}) | ||
.finally(() => { | ||
inflightPromise = undefined; | ||
}); |
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.
@israx can you review this particular change?
Why: Promise
implementation should not be an async function.
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.
I don't see any issue. The asyncFunction
will still resolve. Just in case, can you smock test this change ?
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.
I chose to trust the unit test 😄 will run some smoke tests too
a2ebd14
to
b10e712
Compare
@@ -170,7 +170,7 @@ export class PinpointEventBuffer { | |||
const { Results = {} } = data.EventsResponse ?? {}; | |||
const retryableEvents: BufferedEvent[] = []; | |||
|
|||
Object.entries(Results).forEach(([endpointId, endpointValues]) => { | |||
Object.entries(Results).forEach(([_, endpointValues]) => { |
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.
Can this just be Object.values
then?
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.
Agreed, going to send a PR in to update this loop.
b10e712
to
9b6b249
Compare
Description of changes
yarn lint:fix
yarn lint
but were not auto-fixablenotifications
package after fixing linter issues incore
, this is related to theUserProfile
type incore
NOTE: This PR doesn't fix the linter warnings.
Issue #, if available
Description of how you validated changes
Checklist
yarn test
passesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.