mirror of
				https://github.com/mendableai/firecrawl.git
				synced 2025-11-04 03:53:17 +00:00 
			
		
		
		
	fix(crawl-redis/lockURL): reduce logging
This commit is contained in:
		
							parent
							
								
									6776aee1c3
								
							
						
					
					
						commit
						91a1a9a1fc
					
				@ -151,7 +151,6 @@ export async function lockURL(id: string, sc: StoredCrawl, url: string): Promise
 | 
				
			|||||||
    url = normalizeURL(url, sc);
 | 
					    url = normalizeURL(url, sc);
 | 
				
			||||||
    logger = logger.child({ url });
 | 
					    logger = logger.child({ url });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    logger.debug("Locking URL " + JSON.stringify(url) + "...");
 | 
					 | 
				
			||||||
    await redisConnection.sadd("crawl:" + id + ":visited_unique", url);
 | 
					    await redisConnection.sadd("crawl:" + id + ":visited_unique", url);
 | 
				
			||||||
    await redisConnection.expire("crawl:" + id + ":visited_unique", 24 * 60 * 60, "NX");
 | 
					    await redisConnection.expire("crawl:" + id + ":visited_unique", 24 * 60 * 60, "NX");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -160,14 +159,14 @@ export async function lockURL(id: string, sc: StoredCrawl, url: string): Promise
 | 
				
			|||||||
        res = (await redisConnection.sadd("crawl:" + id + ":visited", url)) !== 0
 | 
					        res = (await redisConnection.sadd("crawl:" + id + ":visited", url)) !== 0
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        const permutations = generateURLPermutations(url).map(x => x.href);
 | 
					        const permutations = generateURLPermutations(url).map(x => x.href);
 | 
				
			||||||
        logger.debug("Adding URL permutations for URL " + JSON.stringify(url) + "...", { permutations });
 | 
					        // logger.debug("Adding URL permutations for URL " + JSON.stringify(url) + "...", { permutations });
 | 
				
			||||||
        const x = (await redisConnection.sadd("crawl:" + id + ":visited", ...permutations));
 | 
					        const x = (await redisConnection.sadd("crawl:" + id + ":visited", ...permutations));
 | 
				
			||||||
        res = x === permutations.length;
 | 
					        res = x === permutations.length;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    await redisConnection.expire("crawl:" + id + ":visited", 24 * 60 * 60, "NX");
 | 
					    await redisConnection.expire("crawl:" + id + ":visited", 24 * 60 * 60, "NX");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    logger.debug("lockURL final result: " + res, { res });
 | 
					    logger.debug("Locking URL " + JSON.stringify(url) + "... result: " + res, { res });
 | 
				
			||||||
    return res;
 | 
					    return res;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user