frostfs-node/pkg/innerring/processors/balance/handlers.go

26 lines
650 B
Go
Raw Normal View History

2020-07-24 13:54:03 +00:00
package balance
import (
"encoding/hex"
"github.com/nspcc-dev/neofs-node/pkg/morph/event"
balanceEvent "github.com/nspcc-dev/neofs-node/pkg/morph/event/balance"
"go.uber.org/zap"
)
func (bp *Processor) handleLock(ev event.Event) {
lock := ev.(balanceEvent.Lock)
2020-07-24 13:54:03 +00:00
bp.log.Info("notification",
zap.String("type", "lock"),
zap.String("value", hex.EncodeToString(lock.ID())))
// send an event to the worker pool
2020-07-24 13:54:03 +00:00
err := bp.pool.Submit(func() { bp.processLock(&lock) })
if err != nil {
// there system can be moved into controlled degradation stage
2020-07-24 13:54:03 +00:00
bp.log.Warn("balance worker pool drained",
zap.Int("capacity", bp.pool.Cap()))
}
}