mongodb-js / data-service

The MongoDB Data Service
Apache License 2.0
7 stars 4 forks source link

feat: add saving last seen topology description COMPASS-4568 #291

Closed Anemy closed 3 years ago

Anemy commented 3 years ago

COMPASS-4568

Previously we were sending the data service with the data-service-initialized event. This event would pass a connection which is not guaranteed to successfully connect, and keeping it around in other plugins will cause unexpected errors. We are removing data-service-initialized event to avoid using an unreliable connection. When removing it we still need to listen to the server topology description changed event which occurs before connecting. This PR updates the data service to store the most recent server TopologyDescription so that we no longer need to listen to a non-connected connection inside of Compass plugins which assume connectivity. (and we can remove the data-service-initialized event).

Related: compass-connect PR: https://github.com/mongodb-js/compass-connect/pull/252 compass-deployment-awareness PR: https://github.com/mongodb-js/compass-deployment-awareness/pull/183 (will be updated with this new data-service functionality after this is merged.)