fix double push of metrics by properly handling tickers (#2374)

This commit is contained in:
mmetc 2023-07-25 12:19:26 +02:00 committed by GitHub
parent 7106d396dc
commit 395cace69f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 11 additions and 8 deletions

View file

@ -26,15 +26,15 @@ func TestAPICSendMetrics(t *testing.T) {
}{
{
name: "basic",
duration: time.Millisecond * 30,
metricsInterval: time.Millisecond * 5,
duration: time.Millisecond * 60,
metricsInterval: time.Millisecond * 10,
expectedCalls: 5,
setUp: func(api *apic) {},
},
{
name: "with some metrics",
duration: time.Millisecond * 30,
metricsInterval: time.Millisecond * 5,
duration: time.Millisecond * 60,
metricsInterval: time.Millisecond * 10,
expectedCalls: 5,
setUp: func(api *apic) {
api.dbClient.Ent.Machine.Delete().ExecX(context.Background())