Alejandro Lopez
ebcc8afbee
All checks were successful
ci/woodpecker/push/pre-commit Pipeline was successful
Signed-off-by: Alejandro Lopez <a.lopez@yadro.com>
16 lines
402 B
Go
16 lines
402 B
Go
package processors
|
|
|
|
import (
|
|
"time"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/innerring/metrics"
|
|
"github.com/panjf2000/ants/v2"
|
|
)
|
|
|
|
func SubmitEvent(pool *ants.Pool, metrics metrics.Register, eventLabel string, eventProcessor func() bool) error {
|
|
return pool.Submit(func() {
|
|
start := time.Now()
|
|
success := eventProcessor()
|
|
metrics.AddEvent(time.Since(start), eventLabel, success)
|
|
})
|
|
}
|