Commit 884dfdb
authored
fix: Fixed the intermittent failure issue in
The reason for its intermittent failure, I believe, is as follows:
We initially set up the `CountDownLatch` with a count of 6, and we will
call `latch.countDown()` at the following three locations:
- A. in `onSubscribe`
- B. in the `finally` block of the `post` method in `HttpClient`
- C. in `onNext`
Ideally, when the test method runs, the sequence of `countDown()` calls
should be like this:
**A B C B C B C**
The `countDown()` function was called a total of 7 times!
This explains why we sometimes see only **2 elements** in `results` when
we do `assertEquals(3, results.size())`. It's because the last `onNext`
may not have completed execution yet.
**What this PR does:**
We could fix this by initializing the `CountDownLatch` to 7. However,
considering the purpose of this test method, I chose instead to keep the
count at 6 and **remove the `latch.countDown()` call in `onSubscribe`**.
Fixes #140
Signed-off-by: Sun Yuhan <[email protected]>
Co-authored-by: Sun Yuhan <[email protected]>testOnMessageStreamNewMessageSendPushNotificationSuccess (#161)1 parent b6712e8 commit 884dfdb
File tree
1 file changed
+0
-11
lines changed- sdk-server-common/src/test/java/io/a2a/server/requesthandlers
1 file changed
+0
-11
lines changedLines changed: 0 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
700 | 700 | | |
701 | 701 | | |
702 | 702 | | |
703 | | - | |
704 | 703 | | |
705 | 704 | | |
706 | 705 | | |
| |||
726 | 725 | | |
727 | 726 | | |
728 | 727 | | |
729 | | - | |
730 | | - | |
731 | | - | |
732 | | - | |
733 | | - | |
734 | | - | |
735 | | - | |
736 | | - | |
737 | | - | |
738 | | - | |
739 | 728 | | |
740 | 729 | | |
741 | 730 | | |
| |||
0 commit comments