MCPcopy Create free account
hub / github.com/ethereum/node-crawler / newNodeDaemon

Function newNodeDaemon

cmd/crawler/api.go:130–146  ·  view source on GitHub ↗

newNodeDaemon reads new nodes from the crawler and puts them in the db Might trigger the invalidation of caches for the api in the future

(crawlerDB, nodeDB *sql.DB)

Source from the content-addressed store, hash-verified

128// newNodeDaemon reads new nodes from the crawler and puts them in the db
129// Might trigger the invalidation of caches for the api in the future
130func newNodeDaemon(crawlerDB, nodeDB *sql.DB) {
131 // Exponentially increase the backoff time
132 retryTimeout := time.Minute
133
134 for {
135 err := transferNewNodes(crawlerDB, nodeDB)
136 if err != nil {
137 log.Error("Failure in transferring new nodes", "err", err)
138 time.Sleep(retryTimeout)
139 retryTimeout *= 2
140 continue
141 }
142
143 retryTimeout = time.Minute
144 time.Sleep(time.Second)
145 }
146}
147
148func dropDaemon(db *sql.DB, dropTimeout time.Duration) {
149 ticker := time.NewTicker(10 * time.Minute)

Callers 1

startAPIFunction · 0.85

Calls 2

transferNewNodesFunction · 0.85
ErrorMethod · 0.80

Tested by

no test coverage detected