Skip to content

Commit

Permalink
lwcapi: batch sub messages (Netflix#1606)
Browse files Browse the repository at this point in the history
When setting up a new subscription, batch the subscription
metadata messages sent to the queue. Otherwise if there
is a large set it they could get written quickly enough to
exceed the queue size.
  • Loading branch information
brharrington authored and manolama committed May 22, 2024
1 parent 15341ce commit af508a2
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,12 @@ class SubscribeApi(

// Add any new expressions
val (queue, addedSubs) = sm.subscribe(streamId, splits)
addedSubs.foreach { sub =>
val subMessages = addedSubs.map { sub =>
val meta = sub.metadata
val exprInfo = LwcDataExpr(meta.id, meta.expression, meta.frequency)
queue.offer(Seq(LwcSubscription(expr.expression, List(exprInfo))))
LwcSubscription(expr.expression, List(exprInfo))
}
queue.offer(subMessages)

// Add expression ids in use by this split
subIdsBuilder ++= splits.map(_.metadata.id)
Expand Down

0 comments on commit af508a2

Please sign in to comment.