[#476] reputation: Make reputation report async
Add handler closure over worker pool in the event package. Add `addNewEpochAsyncNotificationHandler` function that uses that closure. Pass the reputation report handler to worker pool via using that function. Signed-off-by: Pavel Karpy <carpawell@nspcc.ru>
This commit is contained in:
parent
7cd4e409eb
commit
72699b4c26
3 changed files with 43 additions and 8 deletions
|
@ -167,10 +167,24 @@ func (c *cfg) localNodeInfoFromNetmap(nm *netmapSDK.Netmap) *netmapSDK.NodeInfo
|
|||
return nil
|
||||
}
|
||||
|
||||
// addNewEpochNotificationHandler adds handler that will be executed synchronously
|
||||
func addNewEpochNotificationHandler(c *cfg, h event.Handler) {
|
||||
addNetmapNotificationHandler(c, newEpochNotification, h)
|
||||
}
|
||||
|
||||
// addNewEpochAsyncNotificationHandler adds handler that will be executed asynchronously via netmap workerPool
|
||||
func addNewEpochAsyncNotificationHandler(c *cfg, h event.Handler) {
|
||||
addNetmapNotificationHandler(
|
||||
c,
|
||||
newEpochNotification,
|
||||
event.WorkerPoolHandler(
|
||||
c.cfgNetmap.workerPool,
|
||||
h,
|
||||
c.log,
|
||||
),
|
||||
)
|
||||
}
|
||||
|
||||
func goOffline(c *cfg) {
|
||||
err := c.cfgNetmap.wrapper.UpdatePeerState(
|
||||
crypto.MarshalPublicKey(&c.key.PublicKey),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue