Skip to content
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

fix(NODE-5723): emit TopologyDescriptionChangedEvent just before close #3968

Open
wants to merge 34 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
4d443b3
Impleent spec test
W-A-James Apr 18, 2024
f293705
pull in tests
W-A-James Apr 18, 2024
8c77374
Merge branch 'main' into NODE-6052
W-A-James Apr 18, 2024
e59b76b
fix runner bug
W-A-James Apr 19, 2024
91559dd
Merge branch 'NODE-6052' of github.com:mongodb/node-mongodb-native in…
W-A-James Apr 19, 2024
2a394fa
Merge branch 'main' into NODE-6052
W-A-James Apr 19, 2024
c6b46f9
skip tests
W-A-James Apr 19, 2024
574dd9f
reference correct follow-up ticket
W-A-James Apr 19, 2024
62c2a33
Merge branch 'main' into NODE-6052
W-A-James Apr 19, 2024
01e3ccb
Update type names
W-A-James Apr 19, 2024
c2e5dab
Merge branch 'NODE-6052' of github.com:mongodb/node-mongodb-native in…
W-A-James Apr 19, 2024
abf1368
emit TopologyDescriptionChangedEvent just before close
W-A-James Jan 17, 2024
d470625
Unskip tests and pull in updated test
W-A-James Jan 17, 2024
63fd549
remove unneeded modified spec tests
W-A-James Jan 18, 2024
10b9d32
fix socks5 tests
W-A-James Jan 19, 2024
c07a367
small fix
W-A-James Mar 13, 2024
59574a0
add replset test
W-A-James Mar 19, 2024
9cb93f2
Add standalone spec test
W-A-James Mar 19, 2024
9b87b20
add sharded spec test
W-A-James Mar 19, 2024
fed7aa6
add load balanced tests
W-A-James Mar 20, 2024
611f37b
fix event tests
W-A-James Mar 20, 2024
1428c4e
fix matcher
W-A-James Mar 20, 2024
e8c3a52
remove unneeded import
W-A-James Mar 20, 2024
95976c4
fix tests
W-A-James Mar 21, 2024
f0fe66d
fix test
W-A-James Mar 21, 2024
58349b6
update spec tests
W-A-James Mar 25, 2024
890e805
skip correct tests and update runner
W-A-James Mar 25, 2024
be2e640
lint fix
W-A-James Mar 26, 2024
49a648e
bump schema version
W-A-James Apr 19, 2024
3110995
Merge branch 'main' into DRIVERS-2711-POC
W-A-James Apr 25, 2024
bad2791
Merge branch 'main' into DRIVERS-2711-POC
W-A-James May 7, 2024
c6434c0
run ci
W-A-James May 7, 2024
6f67f54
Merge branch 'main' into DRIVERS-2711-POC
W-A-James May 8, 2024
90e6062
ensure topology description is constructed with original options
W-A-James May 9, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions src/sdam/topology.ts
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,8 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {

/** Close this topology */
close(): void {
const previousDescription = this.s.description;

if (this.s.state === STATE_CLOSED || this.s.state === STATE_CLOSING) {
return;
}
Expand All @@ -511,6 +513,21 @@ export class Topology extends TypedEventEmitter<TopologyEvents> {
this.removeListener(Topology.TOPOLOGY_DESCRIPTION_CHANGED, this.s.detectShardedTopology);

stateTransition(this, STATE_CLOSED);
this.s.description = new TopologyDescription(
TopologyType.Unknown,
new Map(),
this.s.options.replicaSet,
undefined,
undefined,
undefined,
this.s.options
);

// broadcast that topology is in closed state
this.emitAndLog(
Topology.TOPOLOGY_DESCRIPTION_CHANGED,
new TopologyDescriptionChangedEvent(this.s.id, previousDescription, this.s.description)
);

// emit an event for close
this.emitAndLog(Topology.TOPOLOGY_CLOSED, new TopologyClosedEvent(this.s.id));
Expand Down

This file was deleted.

This file was deleted.

Loading