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)
| 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 |
| 130 | func 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 | |
| 148 | func dropDaemon(db *sql.DB, dropTimeout time.Duration) { |
| 149 | ticker := time.NewTicker(10 * time.Minute) |
no test coverage detected