Skip to content

Commit

Permalink
lwcapi: batch sub messages (#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 Feb 8, 2024
1 parent 50840e7 commit 076f04f
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 076f04f

Please sign in to comment.