Skip to content

Refactor refnames RPC's to use chunker

Jacob Vosmaer requested to merge refactor-refnames-chunker into master

While this is more wordy than the old code, I think it's less surprising how it works, and it doubles down on using our new "chunker" abstraction.

Context

It's a common pattern in Gitaly that we want to send back an unknown number of items (e.g. commits). We deal with that by using a stream response type. Sending one item per response message would often be wasteful so we try to batch them together. The response is then a stream of messages that each contain a batch (protobuf repeated) of items.

For a long time we've been re-implementing this batching/chunking logic ad hoc in each RPC that uses it. Recently we added a new abstraction to factor out this pattern a bit: !1031 (merged)

Now we're left with lots of existing (old) code in the application that can be refactored to use this new abstraction. In this MR I'm taking on an older abstraction (lines.Sender) which is IMO a little too abstract. This MR eliminates one particular use of lines.Sender in favor of chunker.Chunker.

Edited by GitLab Release Tools Bot

Merge request reports