Skip to content

Commit

Permalink
fix: prevent parallel monitor checks
Browse files Browse the repository at this point in the history
  • Loading branch information
baileympearson committed Sep 9, 2022
1 parent 085471d commit aab1064
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 4 additions & 0 deletions src/sdam/monitor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,10 @@ function checkServer(monitor: Monitor, callback: Callback<Document | null>) {

function monitorServer(monitor: Monitor) {
return (callback: Callback) => {
if (monitor.s.state === STATE_MONITORING) {
callback();
return;
}
stateTransition(monitor, STATE_MONITORING);
function done() {
if (!isInCloseState(monitor)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,24 +19,22 @@ const filter: TestFilter = ({ description }) => {
return isAuthEnabled
? 'TODO(NODE-3135): handle auth errors, also see NODE-3891: fix tests broken when AUTH enabled'
: false;
case 'Network error on Monitor check':
case 'Network timeout on Monitor check':
return 'TODO(NODE-4608): Disallow parallel monitor checks';
// case 'Network error on Monitor check':
// case 'Network timeout on Monitor check':
// return 'TODO(NODE-4608): Disallow parallel monitor checks';
default:
return false;
}
};

describe('SDAM Unified Tests', function () {
describe.only('SDAM Unified Tests', function () {
afterEach(async function () {
if (this.currentTest!.pending) {
return;
}
// TODO(NODE-4573): fix socket leaks
const LEAKY_TESTS = [
'Command error on Monitor handshake',
'Network error on Monitor check',
'Network timeout on Monitor check',
'Network error on Monitor handshake',
'Network timeout on Monitor handshake'
];
Expand Down

0 comments on commit aab1064

Please sign in to comment.