fix(discord): harden reconnect recovery and preserve message delivery

Landed from contributor PR #29508 by @cgdusek.

Co-authored-by: Charles Dusek <cgdusek@gmail.com>
This commit is contained in:
Peter Steinberger
2026-03-01 23:45:34 +00:00
parent a0d2f6e4fe
commit 5056b6438d
7 changed files with 353 additions and 51 deletions

View File

@@ -84,12 +84,14 @@ describe("createFeishuWSClient proxy handling", () => {
createFeishuWSClient(baseAccount);
const expectedHttpsProxy = process.env.https_proxy || process.env.HTTPS_PROXY;
// On Windows env keys are case-insensitive, so setting HTTPS_PROXY may
// overwrite https_proxy. We assert https proxies still win over http.
const expectedProxy = process.env.https_proxy || process.env.HTTPS_PROXY;
expect(expectedProxy).toBeTruthy();
expect(httpsProxyAgentCtorMock).toHaveBeenCalledTimes(1);
expect(expectedHttpsProxy).toBeTruthy();
expect(httpsProxyAgentCtorMock).toHaveBeenCalledWith(expectedHttpsProxy);
expect(httpsProxyAgentCtorMock).toHaveBeenCalledWith(expectedProxy);
const options = firstWsClientOptions();
expect(options.agent).toEqual({ proxyUrl: expectedHttpsProxy });
expect(options.agent).toEqual({ proxyUrl: expectedProxy });
});
it("passes HTTP_PROXY to ws client when https vars are unset", () => {