mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Merge branch 'bg-add-queue-metrics' of github.com:overleaf/document-updater into bg-add-queue-metrics
This commit is contained in:
commit
21824d49da
2 changed files with 9 additions and 2 deletions
|
@ -40,9 +40,13 @@ module.exports = RealTimeRedisManager =
|
|||
# create a unique message id using a counter
|
||||
message_id = "doc:#{HOST}:#{RND}-#{COUNT++}"
|
||||
data?._id = message_id
|
||||
|
||||
blob = JSON.stringify(data)
|
||||
metrics.summary "redis.publish.applied-ops", blob.length
|
||||
|
||||
# publish on separate channels for individual projects and docs when
|
||||
# configured (needs realtime to be configured for this too).
|
||||
if Settings.publishOnIndividualChannels
|
||||
pubsubClient.publish "applied-ops:#{data.doc_id}", JSON.stringify(data)
|
||||
pubsubClient.publish "applied-ops:#{data.doc_id}", blob
|
||||
else
|
||||
pubsubClient.publish "applied-ops", JSON.stringify(data)
|
||||
pubsubClient.publish "applied-ops", blob
|
||||
|
|
|
@ -90,3 +90,6 @@ describe "RealTimeRedisManager", ->
|
|||
|
||||
it "should send the op with a message id", ->
|
||||
@pubsubClient.publish.calledWith("applied-ops", JSON.stringify({op:"thisop",_id:@message_id})).should.equal true
|
||||
|
||||
it "should track the payload size", ->
|
||||
@metrics.summary.calledWith("redis.publish.applied-ops", JSON.stringify({op:"thisop",_id:@message_id}).length).should.equal true
|
||||
|
|
Loading…
Reference in a new issue