[#873] innerring: Reuse atomic IR's epochDuration instead of RPC call

Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
Pavel Karpy 2021-10-14 14:04:09 +03:00 committed by Alex Vanin
parent 505d92bb06
commit 96a65df32b
4 changed files with 18 additions and 38 deletions

View file

@ -10,12 +10,6 @@ import (
// Process new epoch notification by setting global epoch value and resetting
// local epoch timer.
func (np *Processor) processNewEpoch(epoch uint64) {
np.epochState.SetEpochCounter(epoch)
if err := np.epochTimer.ResetEpochTimer(); err != nil {
np.log.Warn("can't reset epoch timer",
zap.String("error", err.Error()))
}
epochDuration, err := np.netmapClient.EpochDuration()
if err != nil {
np.log.Warn("can't get epoch duration",
@ -24,6 +18,12 @@ func (np *Processor) processNewEpoch(epoch uint64) {
np.epochState.SetEpochDuration(epochDuration)
}
np.epochState.SetEpochCounter(epoch)
if err := np.epochTimer.ResetEpochTimer(); err != nil {
np.log.Warn("can't reset epoch timer",
zap.String("error", err.Error()))
}
// get new netmap snapshot
networkMap, err := np.netmapClient.Snapshot()
if err != nil {