8000 [Backport M84] Backport #7654 and #7669 to m84 by pkukielka · Pull Request #7681 · sourcegraph/cody · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

[Backport M84] Backport #7654 and #7669 to m84 #7681

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

Merged
merged 2 commits into from
Apr 7, 2025
Merged

Conversation

pkukielka
Copy link
Contributor

Backport of 7654 and 7669 to M84

CC @sourcegraph/release

Test plan

As in:
#7654
#7669

## Changes

I removed global `requestTimings: WeakMap<ClientRequest,
RequestTimings>` map, as those objects by no means need to be stored
globally. We can create them on the request level and pass downstream to
the listeners.
Then request/socket object will get destroyed those objects will be
destroyed as well.

In my opinion there is no need for listeners removal as listener
callbacks will be garbage collected when request/socket object will be
removed (as long as we don't also put it in global disposables array as
before).

## Test plan

1. Disable network connection
3. Open `Cody: Network` output channel
4. Do some cody actions (e.g. try to use chat)
5. You should see some network errors logged (no change in behaviour):

![image](https://github.com/user-attachments/assets/f720b5eb-5775-41ac-b889-94aa69f58d24)

(cherry picked from commit e8258b2)
## Changes

Looks like in case of the socket we cannot rely on the automatic cleanup
upon the object destruction, because we are reusing the sockets. That is
why we need to manually remove listeners when the socket is closed.

## Test plan

1. Play with Cody for a while (1 min of editing a text file is more than
enough)
2. Search log for "leak detected" - there should be no leaks or too many
listener warnings.

<!-- Required. See
https://docs-legacy.sourcegraph.com/dev/background-information/testing_principles.
-->

(cherry picked from commit 49cdd04)
@pkukielka pkukielka changed the title Backport 7654 and 7669 to m84 [Backport M84] Backport #7654 and #7669 to m84 Apr 7, 2025
@hitesh-1997 hitesh-1997 merged commit 1c1ea94 into M84 Apr 7, 2025
21 of 26 checks passed
@hitesh-1997 hitesh-1997 deleted the backport-7669-to-M84 branch April 7, 2025 16:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants
0