Evgenii Stratonikov
0e31c12e63
Drop duplicate entities. Format entities. Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com> Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
26 lines
749 B
Go
26 lines
749 B
Go
package balance
|
|
|
|
import (
|
|
"encoding/hex"
|
|
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
|
|
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event"
|
|
balanceEvent "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/morph/event/balance"
|
|
"go.uber.org/zap"
|
|
)
|
|
|
|
func (bp *Processor) handleLock(ev event.Event) {
|
|
lock := ev.(balanceEvent.Lock)
|
|
bp.log.Info(logs.BalanceNotification,
|
|
zap.String("type", "lock"),
|
|
zap.String("value", hex.EncodeToString(lock.ID())))
|
|
|
|
// send an event to the worker pool
|
|
|
|
err := bp.pool.Submit(func() { bp.processLock(&lock) })
|
|
if err != nil {
|
|
// there system can be moved into controlled degradation stage
|
|
bp.log.Warn(logs.BalanceBalanceWorkerPoolDrained,
|
|
zap.Int("capacity", bp.pool.Cap()))
|
|
}
|
|
}
|