-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Use await instead of promises #1495
Conversation
This may have been obviated by #1489 🙂 |
Haha, yes, most is obviated. But a few last changes are left. |
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.
Nice!
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.
@santhoshvaddi PTAL
// Return a formatted message | ||
resolve(formatSlackMessage(query, response)); | ||
const makeSearchRequest = async query => { | ||
await kgsearch.entities.search( |
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 know if this actually returns a promise? (either via running it ourselves, or reviewing Slack's docs)
- If so, we should get rid of the callback below. 🙂
} catch (err) { | ||
console.error(err); | ||
res.status(err.code || 500).send(err); | ||
return Promise.reject(err); | ||
throw err; |
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.
Nit (perhaps better addressed in a different PR): redundant?
`SingerId: ${row.SingerId}, ` + | ||
`AlbumId: ${row.AlbumId}, ` + | ||
`AlbumTitle: ${row.AlbumTitle}\n` | ||
`SingerId: ${row.SingerId}, AlbumId: ${row.AlbumId}, AlbumTitle: ${row.AlbumTitle}\n` |
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 believe @grant was 👎on this.
pushNotification( | ||
data['deviceID'], | ||
doc.data().accessToken, | ||
doc.data().expireTime | ||
); | ||
return doc.data(); | ||
await doc.data(); |
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.
This seems confusing - why are we using doc.data()
presumably before we've await
ed it? (If we know this case definitely won't happen, we should at least leave a comment explaining that.)
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.
After push notification we just want to return from the function. The client will receive the token in the form of push notification. I don't think await
is required here.
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.
LGTM for /cloud-sql/
Drive-by fix: Run linter for template strings.