Page MenuHomePhabricator

[keyserver] await dbQuery in updateLatestMessages
ClosedPublic

Authored by ashoat on Dec 4 2023, 1:20 PM.
Tags
None
Referenced Files
Unknown Object (File)
Thu, Nov 7, 5:09 AM
Unknown Object (File)
Oct 16 2024, 2:35 AM
Unknown Object (File)
Oct 16 2024, 2:35 AM
Unknown Object (File)
Oct 16 2024, 2:35 AM
Unknown Object (File)
Oct 16 2024, 2:34 AM
Unknown Object (File)
Oct 16 2024, 2:34 AM
Unknown Object (File)
Oct 13 2024, 7:03 AM
Unknown Object (File)
Oct 11 2024, 6:30 AM
Subscribers

Details

Summary

The unused-promise Lint identified an issue here. updateLatestMessages gets called from postMessageSend, and we make sure to handle promise rejections there.

But since we don't await the call to updateLatestMessages from that code, there's a potential that the dbQuery inside updateLatestMessages fails. This promise rejection would not be handled, and as such would crash the keyserver.

This diff allows us to pass those promise rejections through to postMessageSend, which avoids the issue.

I considered simply returning the dbQuery Promise (async/await syntax isn't really necessary here), but it's a little more annoying because we have an early exit at the start of the function.

Depends on D10180

Test Plan

Flow

Diff Detail

Repository
rCOMM Comm
Lint
No Lint Coverage
Unit
No Test Coverage