Page MenuHomePhabricator

[keyserver] Ignore promise rejections from websocket message handler
ClosedPublic

Authored by ashoat on Dec 4 2023, 1:21 PM.
Tags
None
Referenced Files
Unknown Object (File)
Mon, Mar 31, 7:06 AM
Unknown Object (File)
Sun, Mar 23, 10:38 AM
Unknown Object (File)
Wed, Mar 12, 10:13 AM
Unknown Object (File)
Mon, Mar 3, 4:05 PM
Unknown Object (File)
Feb 25 2025, 8:10 AM
Unknown Object (File)
Feb 19 2025, 5:19 PM
Unknown Object (File)
Feb 19 2025, 5:19 PM
Unknown Object (File)
Feb 19 2025, 5:18 PM
Subscribers

Details

Summary

The unused-promise Lint identified an issue here. onMessage can reject, in which case it doesn't appear to be handled.

To make sure it wasn't handled, I investigated how the redis library handles it. Internally that library extends Node's built-in EventEmitter, and that library explains how it handles things here. Since captureRejections: true is not set by the redis library, that means promise rejections will crash keyserver.

To avoid that, in this diff I wrap the call with ignorePromiseRejections. The conditional is necessary because onMessageCallback returns void | Promise<void>.

Depends on D10182

Test Plan

Flow

Diff Detail

Repository
rCOMM Comm
Lint
Lint Not Applicable
Unit
Tests Not Applicable