Skip to content

Commit 1920d28

Browse files
committed
fix fetch execution nodes to crawl query
1 parent 1bfa6c5 commit 1920d28

2 files changed

Lines changed: 7 additions & 7 deletions

File tree

pkg/database/db.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,18 +76,18 @@ func NewDB(
7676
nextCrawlNotEth: nextCrawlNotEth,
7777
githubToken: githubToken,
7878

79-
executionNodesToCrawlCache: make(chan *NodeToCrawl, 2048),
79+
executionNodesToCrawlCache: make(chan *NodeToCrawl, 16392),
8080
executionNodesToCrawlLock: new(sync.Mutex),
81-
executionRecentlyCrawled: fifomemory.New[enode.ID](256),
81+
executionRecentlyCrawled: fifomemory.New[enode.ID](16392),
8282

8383
consensusNodesToCrawlCache: make(chan *NodeToCrawl, 2048),
8484
consensusNodesToCrawlLock: new(sync.Mutex),
8585
consensusRecentlyCrawled: fifomemory.New[enode.ID](256),
8686
// consensusActiveCrawlers: map[enode.ID]struct{}{},
8787

88-
discNodesToCrawlCache: make(chan *NodeToCrawl, 2048),
88+
discNodesToCrawlCache: make(chan *NodeToCrawl, 16392),
8989
discNodesToCrawlLock: new(sync.Mutex),
90-
discRecentlyCrawled: fifomemory.New[enode.ID](256),
90+
discRecentlyCrawled: fifomemory.New[enode.ID](16392),
9191

9292
discUpdateCache: fifomemory.New[enode.ID](1024),
9393

pkg/database/disc.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ func (db *DB) fetchExecutionNodesToCrawl(ctx context.Context) error {
218218
rows, err := db.pg.Query(
219219
ctx,
220220
`
221-
WITH last_crawled AS (
221+
WITH last_crawled AS MATERIALIZED (
222222
SELECT node_id
223223
FROM crawler.next_disc_crawl
224224
WHERE last_found > now() - INTERVAL '48 hours'
@@ -227,12 +227,12 @@ func (db *DB) fetchExecutionNodesToCrawl(ctx context.Context) error {
227227
next_node_crawl.next_crawl,
228228
node_record
229229
FROM crawler.next_node_crawl
230-
INNER JOIN crawler.next_disc_crawl USING (node_id)
230+
INNER JOIN last_crawled USING (node_id)
231231
INNER JOIN disc.nodes USING (node_id)
232232
WHERE
233233
next_node_crawl.node_type IN ('Unknown', 'Execution')
234234
ORDER BY next_node_crawl.next_crawl
235-
LIMIT 1024
235+
LIMIT 4096
236236
`,
237237
)
238238
if err != nil {

0 commit comments

Comments
 (0)