Skip to content

Commit 986a9a1

Browse files
committed
internal: finish an async request after it queued
The change helps to make the order of execution and sending of async requests the same. As example: conn.Do(AsyncRequest1).Get() conn.Do(AsyncRequest2).Get() It is now guaranteed that AsyncRequest2 will be sent to the network after AsyncRequest1. Before the patch the order was undefined. Part of #284
1 parent 8fa9901 commit 986a9a1

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

connection.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,6 +1066,10 @@ func (conn *Connection) putFuture(fut *Future, req Request, streamId uint64) {
10661066
}
10671067
shard.bufmut.Unlock()
10681068

1069+
if firstWritten {
1070+
conn.dirtyShard <- shardn
1071+
}
1072+
10691073
if req.Async() {
10701074
if fut = conn.fetchFuture(reqid); fut != nil {
10711075
resp := &Response{
@@ -1076,10 +1080,6 @@ func (conn *Connection) putFuture(fut *Future, req Request, streamId uint64) {
10761080
conn.markDone(fut)
10771081
}
10781082
}
1079-
1080-
if firstWritten {
1081-
conn.dirtyShard <- shardn
1082-
}
10831083
}
10841084

10851085
func (conn *Connection) markDone(fut *Future) {

0 commit comments

Comments
 (0)