()
| 532 | } |
| 533 | |
| 534 | private measureRoundTripTime() { |
| 535 | const start = processTimeMS(); |
| 536 | |
| 537 | if (this.closed) { |
| 538 | return; |
| 539 | } |
| 540 | |
| 541 | const connection = this.connection; |
| 542 | if (connection == null) { |
| 543 | connect(this.monitor.connectOptions).then( |
| 544 | connection => { |
| 545 | this.measureAndReschedule(start, connection); |
| 546 | }, |
| 547 | () => { |
| 548 | this.connection = undefined; |
| 549 | } |
| 550 | ); |
| 551 | return; |
| 552 | } |
| 553 | |
| 554 | const commandName = |
| 555 | connection.serverApi?.version || connection.helloOk ? 'hello' : LEGACY_HELLO_COMMAND; |
| 556 | |
| 557 | connection.command(ns('admin.$cmd'), { [commandName]: 1 }, undefined).then( |
| 558 | () => this.measureAndReschedule(start), |
| 559 | () => { |
| 560 | this.connection?.destroy(); |
| 561 | this.connection = undefined; |
| 562 | return; |
| 563 | } |
| 564 | ); |
| 565 | } |
| 566 | } |
| 567 | |
| 568 | /** |
no test coverage detected