Skip to content

Commit 460bdcf

Browse files
committed
tweak requestOnPull
1 parent 32595a3 commit 460bdcf

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

runtime/src/main/scala/fs2/grpc/server/internal/Fs2ServerCall.scala

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -73,11 +73,10 @@ private[server] final class Fs2ServerCall[Request, Response](
7373
dispatcher
7474
)
7575

76-
def requestOnPull[F[_]]: Pipe[F, Request, Request] =
77-
_.mapChunks { chunk =>
78-
call.request(chunk.size)
79-
chunk
80-
}
76+
def requestOnPull[F[_]](implicit F: Sync[F]): Pipe[F, Request, Request] =
77+
_.chunks.flatMap(chunk =>
78+
Stream.evalUnChunk(F.as(F.delay(call.request(chunk.size)), chunk))
79+
)
8180

8281
def request(n: Int): SyncIO[Unit] =
8382
SyncIO(call.request(n))

0 commit comments

Comments
 (0)