Commit 391b4d8
committed
Don't automatically start requesting on subscribe, close #1380
Motivation:
HandlerSubscriber automatically starts requests when calling
onSubscribe.
But when a publisher subscribes, RxJava automatically requests the
Subscription if there are some pending requests.
When such race condition happen, we end up with 2 threads (calling and
event loop) competing for requesting the Subscription. This results is
out of order published messages.
Modification:
Make HandlerSubscriber#onSubscribe noop and actually delay it to after
Publisher has subscribed.
Result:
No more out of order messages.1 parent 8c27b67 commit 391b4d8
File tree
1 file changed
+12
-0
lines changed- client/src/main/java/org/asynchttpclient/netty/request/body
1 file changed
+12
-0
lines changedLines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
58 | 58 | | |
59 | 59 | | |
60 | 60 | | |
| 61 | + | |
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| |||
108 | 109 | | |
109 | 110 | | |
110 | 111 | | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
111 | 123 | | |
112 | 124 | | |
113 | 125 | | |
| |||
0 commit comments