fix(storage): resolve race condition in memory store (#1270)
* fix(storage): resolve race condition in memory store * fix: resolve variable shadowing in CopyEndpointStatus * fix: update test files to use CopyEndpointStatus function
This commit is contained in:
@@ -8,14 +8,14 @@ import (
|
||||
"github.com/TwiN/gatus/v5/storage/store/common/paging"
|
||||
)
|
||||
|
||||
func BenchmarkShallowCopyEndpointStatus(b *testing.B) {
|
||||
func BenchmarkCopyEndpointStatus(b *testing.B) {
|
||||
ep := &testEndpoint
|
||||
status := endpoint.NewStatus(ep.Group, ep.Name)
|
||||
for i := 0; i < storage.DefaultMaximumNumberOfResults; i++ {
|
||||
AddResult(status, &testSuccessfulResult, storage.DefaultMaximumNumberOfResults, storage.DefaultMaximumNumberOfEvents)
|
||||
}
|
||||
for n := 0; n < b.N; n++ {
|
||||
ShallowCopyEndpointStatus(status, paging.NewEndpointStatusParams().WithResults(1, 20))
|
||||
CopyEndpointStatus(status, paging.NewEndpointStatusParams().WithResults(1, 20))
|
||||
}
|
||||
b.ReportAllocs()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user