File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -101,6 +101,8 @@ console.log("Press Ctrl+C to stop.\n");
101101
102102let submitted = 0 ;
103103let acked = 0 ;
104+ let lastLogTime = Date . now ( ) ;
105+ let lastSubmitted = 0 ;
104106
105107// Transform that filters posts and converts to AppendRecord.
106108const toAppendRecord = new TransformStream < JetstreamEvent , AppendRecord > ( {
@@ -139,8 +141,13 @@ const ackLoop = (async () => {
139141} ) ( ) ;
140142
141143const logInterval = setInterval ( ( ) => {
144+ const now = Date . now ( ) ;
145+ const elapsed = ( now - lastLogTime ) / 1000 ;
146+ const rate = ( ( submitted - lastSubmitted ) / elapsed ) . toFixed ( 1 ) ;
147+ lastLogTime = now ;
148+ lastSubmitted = submitted ;
142149 console . log (
143- `submitted=${ submitted } acked=${ acked } inflight=${ submitted - acked } ` ,
150+ `submitted=${ submitted } acked=${ acked } inflight=${ submitted - acked } ( ${ rate } msg/s) ` ,
144151 ) ;
145152} , 1000 ) ;
146153
You can’t perform that action at this time.
0 commit comments