Skip to content
This repository was archived by the owner on Mar 28, 2023. It is now read-only.

Commit 9422da7

Browse files
committed
Move the update search push
1 parent 7b7caf9 commit 9422da7

File tree

1 file changed

+21
-21
lines changed

1 file changed

+21
-21
lines changed

core/core.go

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -158,27 +158,6 @@ func (n *OpenBazaarNode) SeedNode() error {
158158
}
159159
n.RootHash = rootHash
160160

161-
go func() {
162-
// Update search endpoint with published hash
163-
peerId, _ := n.GetNodeID()
164-
endpoint := fmt.Sprintf("https://search.ob1.io/update/%s/%s", peerId.PeerID, rootHash)
165-
log.Infof("Publishing new rootHash to: %s\n", endpoint)
166-
167-
var client *http.Client
168-
if n.TorDialer != nil {
169-
tbTransport := &http.Transport{Dial: n.TorDialer.Dial}
170-
client = &http.Client{Transport: tbTransport, Timeout: time.Second * 30}
171-
} else {
172-
client = &http.Client{Timeout: time.Second * 30}
173-
}
174-
175-
resp, err := client.Get(endpoint)
176-
if err != nil {
177-
log.Errorf("Search update did not succeed. %v\n", err)
178-
}
179-
log.Debugf("%s response: %v", endpoint, resp)
180-
}()
181-
182161
n.seedLock.Unlock()
183162
n.InitalPublishComplete = true
184163
go n.publish(rootHash)
@@ -204,6 +183,27 @@ func (n *OpenBazaarNode) publish(hash string) {
204183
return
205184
}
206185

186+
go func() {
187+
// Update search endpoint with published hash
188+
peerId, _ := n.GetNodeID()
189+
endpoint := fmt.Sprintf("https://search.ob1.io/update/%s/%s", peerId.PeerID, hash)
190+
log.Infof("Publishing new rootHash to: %s\n", endpoint)
191+
192+
var client *http.Client
193+
if n.TorDialer != nil {
194+
tbTransport := &http.Transport{Dial: n.TorDialer.Dial}
195+
client = &http.Client{Transport: tbTransport, Timeout: time.Second * 30}
196+
} else {
197+
client = &http.Client{Timeout: time.Second * 30}
198+
}
199+
200+
resp, err := client.Get(endpoint)
201+
if err != nil {
202+
log.Errorf("Search update did not succeed. %v\n", err)
203+
}
204+
log.Debugf("%s response: %v", endpoint, resp)
205+
}()
206+
207207
inflightPublishRequests++
208208
err = ipfs.Publish(n.IpfsNode, hash)
209209

0 commit comments

Comments
 (0)