Commit 640de87
[DBMON-6882] Make Postgres check teardown idempotent (#24852)
* [DBMON-6882] Make Postgres check teardown idempotent
_finalize() now runs at most once. The check is already cancelled more than once in
practice -- run_one_check() cancels and the integration_check fixture cancels again on
teardown -- so teardown re-closed connections and re-tore down the async jobs each time.
Nulling log.check also moves after the final log line. CheckLoggingAdapter.process reads
back through that attribute for checks whose check_id was never resolved, so the trailing
debug call raised AttributeError once debug logging was enabled.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Add changelog
Co-authored-by: Cursor <cursoragent@cursor.com>
* Trim teardown test coverage
Drop the logging-hazard test and the rationale comment on the idempotency test.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Do not log from the finalize guard
The first teardown nulls log.check, so a second call cannot log through the adapter --
which is the very hazard this change is fixing elsewhere.
Co-authored-by: Cursor <cursoragent@cursor.com>
---------
Co-authored-by: Cursor <cursoragent@cursor.com>1 parent b59c8b0 commit 640de87
3 files changed
Lines changed: 25 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
199 | 199 | | |
200 | 200 | | |
201 | 201 | | |
| 202 | + | |
202 | 203 | | |
203 | 204 | | |
204 | 205 | | |
| |||
537 | 538 | | |
538 | 539 | | |
539 | 540 | | |
540 | | - | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
541 | 546 | | |
542 | 547 | | |
543 | 548 | | |
544 | 549 | | |
545 | 550 | | |
546 | 551 | | |
547 | | - | |
548 | 552 | | |
549 | 553 | | |
550 | 554 | | |
551 | 555 | | |
552 | 556 | | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
553 | 560 | | |
554 | 561 | | |
555 | 562 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
519 | 519 | | |
520 | 520 | | |
521 | 521 | | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
522 | 537 | | |
523 | 538 | | |
524 | 539 | | |
| |||
0 commit comments