Keep Peer Caching + Resource Verification.
This commit is contained in:
@@ -68,18 +68,16 @@ func (ix *LongLivedStreamRecordedService[T]) gc() {
|
||||
}
|
||||
ix.PubsubMu.Lock()
|
||||
if ix.LongLivedPubSubs[TopicPubSubNodeActivity] != nil {
|
||||
ad, err := pp.AddrInfoFromString("/ip4/" + conf.GetConfig().Hostname + "/tcp/" + fmt.Sprintf("%v", conf.GetConfig().NodeEndpointPort) + "/p2p/" + ix.Host.ID().String())
|
||||
if err == nil {
|
||||
if b, err := json.Marshal(TopicNodeActivityPub{
|
||||
Disposer: *ad,
|
||||
Name: rec.HeartbeatStream.Name,
|
||||
DID: rec.HeartbeatStream.DID,
|
||||
PeerID: pid.String(),
|
||||
NodeActivity: peer.OFFLINE,
|
||||
}); err == nil {
|
||||
ix.LongLivedPubSubs[TopicPubSubNodeActivity].Publish(context.Background(), b)
|
||||
}
|
||||
if b, err := json.Marshal(TopicNodeActivityPub{
|
||||
Disposer: "/ip4/" + conf.GetConfig().Hostname + "/tcp/" + fmt.Sprintf("%v", conf.GetConfig().NodeEndpointPort) + "/p2p/" + ix.Host.ID().String(),
|
||||
Name: rec.HeartbeatStream.Name,
|
||||
DID: rec.HeartbeatStream.DID,
|
||||
PeerID: pid.String(),
|
||||
NodeActivity: peer.OFFLINE.EnumIndex(),
|
||||
}); err == nil {
|
||||
ix.LongLivedPubSubs[TopicPubSubNodeActivity].Publish(context.Background(), b)
|
||||
}
|
||||
|
||||
}
|
||||
ix.PubsubMu.Unlock()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user