2021-03-31 15:38:01 +00:00
|
|
|
package reputation
|
|
|
|
|
|
|
|
import (
|
|
|
|
"encoding/hex"
|
|
|
|
|
|
|
|
"github.com/nspcc-dev/neofs-node/pkg/morph/event"
|
|
|
|
reputationEvent "github.com/nspcc-dev/neofs-node/pkg/morph/event/reputation"
|
|
|
|
"go.uber.org/zap"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (rp *Processor) handlePutReputation(ev event.Event) {
|
|
|
|
put := ev.(reputationEvent.Put)
|
2021-04-05 09:29:33 +00:00
|
|
|
peerID := put.PeerID()
|
|
|
|
|
2022-02-07 13:34:02 +00:00
|
|
|
// FIXME: #1147 do not use `ToV2` method outside neofs-api-go library
|
2021-03-31 15:38:01 +00:00
|
|
|
rp.log.Info("notification",
|
|
|
|
zap.String("type", "reputation put"),
|
2022-07-04 13:24:51 +00:00
|
|
|
zap.String("peer_id", hex.EncodeToString(peerID.PublicKey())))
|
2021-03-31 15:38:01 +00:00
|
|
|
|
|
|
|
// send event to the worker pool
|
|
|
|
|
2021-09-08 15:20:02 +00:00
|
|
|
err := rp.pool.Submit(func() { rp.processPut(&put) })
|
2021-03-31 15:38:01 +00:00
|
|
|
if err != nil {
|
|
|
|
// there system can be moved into controlled degradation stage
|
|
|
|
rp.log.Warn("reputation worker pool drained",
|
|
|
|
zap.Int("capacity", rp.pool.Cap()))
|
|
|
|
}
|
|
|
|
}
|