Skip to content

Commit

Permalink
checking if is worker for work logging
Browse files Browse the repository at this point in the history
  • Loading branch information
jdutchak committed Jul 12, 2024
1 parent af427e9 commit ecf357f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion pkg/api/handlers_node.go
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,7 @@ func (api *API) GetFromDHT() gin.HandlerFunc {
}).Error("Failed to read data from DHT")
c.JSON(http.StatusInternalServerError, gin.H{
"success": false,
"message": "failed to read data",
"message": "no data",
})
return
}
Expand Down
14 changes: 10 additions & 4 deletions pkg/workers/workers.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,17 @@ func (a *Worker) Receive(ctx actor.Context) {
case *messages.Connect:
a.HandleConnect(ctx, m)
case *actor.Started:
a.HandleLog(ctx, "[+] Actor started")
if a.Node.IsWorker() {
a.HandleLog(ctx, "[+] Actor started")
}
case *actor.Stopping:
a.HandleLog(ctx, "[+] Actor stopping")
if a.Node.IsWorker() {
a.HandleLog(ctx, "[+] Actor stopping")
}
case *actor.Stopped:
a.HandleLog(ctx, "[+] Actor stopped")
if a.Node.IsWorker() {
a.HandleLog(ctx, "[+] Actor stopped")
}
case *messages.Work:
if a.Node.IsWorker() {
a.HandleWork(ctx, m, a.Node)
Expand Down Expand Up @@ -315,8 +321,8 @@ func SendWork(node *masa.OracleNode, m *pubsub2.Message) {
for _, p := range peers {
for _, addr := range p.Multiaddrs {
ipAddr, _ := addr.ValueForProtocol(multiaddr.P_IP4)
logrus.Infof("[+] Worker Address: %s", ipAddr)
if !isBootnode(ipAddr) && (p.IsTwitterScraper || p.IsWebScraper || p.IsDiscordScraper) {
logrus.Infof("[+] Worker Address: %s", ipAddr)
wg.Add(1)
go func(p pubsub.NodeData) {
defer wg.Done()
Expand Down

0 comments on commit ecf357f

Please sign in to comment.