forked from TrueCloudLab/frostfs-node
17 lines
402 B
Go
17 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)
|
||
|
})
|
||
|
}
|