Skip to content

ExpAvgMeasurement doesn't properly handle add after update during warmup #212

@jhalterman

Description

@jhalterman

I noticed that ExpAvgMeasurement doesn't properly handle an add after an update when still in warmup mode. Here's a failing test:

  @Test
  public void testUpdateThenAdd() {
    ExpAvgMeasurement avg = new ExpAvgMeasurement(100, 10);
    avg.update(i -> 50);
    avg.add(100);

    Assert.assertEquals(67, avg.get().doubleValue(), 0.1);
  }

It might make sense to consider the warmup phase done once any update happens.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions