File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -176,16 +176,20 @@ const {
176176}
177177
178178( async ( ) => {
179+ // Chunk generations are aligned to the histogram's creation time. Use two
180+ // chunks so that a chunk boundary falling between record() and snapshot()
181+ // cannot drop the freshly recorded value, and wait for a duration that is
182+ // not a multiple of chunkDuration so the wakeup does not land on a boundary.
179183 const histogram = createSlidingWindowHistogram ( {
180- chunks : 1 ,
184+ chunks : 2 ,
181185 chunkDuration : 100 ,
182186 highest : 100 ,
183187 } ) ;
184188
185189 histogram . record ( 1 ) ;
186190 assert . strictEqual ( histogram . snapshot ( ) . count , 1 ) ;
187191
188- await delay ( common . platformTimeout ( 200 ) ) ;
192+ await delay ( common . platformTimeout ( 250 ) ) ;
189193 assert . strictEqual ( histogram . snapshot ( ) . count , 0 ) ;
190194
191195 histogram . record ( 2 ) ;
You can’t perform that action at this time.
0 commit comments