Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[Bug]: crwl always bypasses the cache, -c cache_mode=enabled is ignored

Đã đóng Phù hợp với người mới
#2,365 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
66/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
python
Lĩnh vực
cli

Hướng nghiên cứu

Bắt đầu từ tùy chọn Click --bypass-cache được khai báo trên cả lệnh crwl và crwl crawl, sau đó xem khối if bypass_cache: đặt CacheMode.BYPASS sau khi -c được áp dụng. Issue không nói các phần này nằm trong tệp nào, vì vậy hãy tìm theo chuỗi của tùy chọn. Hoàn thành khi chạy crwl https://example.com -o md -c cache_mode=enabled hai lần, lần chạy thứ hai cho cache hit và giá trị mặc định của cờ không còn ghi đè -c cache_mode nữa.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

🐞 Bug

--bypass-cache is declared as a flag with default=True, in both crwl and crwl crawl:

@click.option("--bypass-cache", "-bc", is_flag=True, default=True, help="Bypass cache when crawling")

So bypass_cache is always True, and this runs after -c / --crawler-config are applied:

if bypass_cache:
    crawler_cfg.cache_mode = CacheMode.BYPASS

Because of that, -c cache_mode=enabled (or a crawler config file that sets it) is silently ignored, and the CLI never reads or writes the cache.

Repro (0.9.4)
crwl https://example.com -o md -c cache_mode=enabled
crwl https://example.com -o md -c cache_mode=enabled

Both runs fetch the page again, and ~/.crawl4ai/crawl4ai.db never gets a crawled_data table. The same thing from Python works fine: CrawlerRunConfig(cache_mode=CacheMode.ENABLED) gives cache_status miss, then hit.

Fix idea

Make it default=False (keep the flag), or turn it into --bypass-cache/--use-cache. Then only override cache_mode when the user did not set it with -c. Today crwl bypasses the cache by default, so we probably want to keep that as the default and just let -c cache_mode=... win.

Found while looking at the community plugins in #2316. Both of them pass -c cache_mode=enabled and expect caching to work.

Ngôn ngữ chính
Python
Star
85.4k
Fork
8.9k
Merge trung bình
6 ngày 5 giờ
Pull request đã merge (30 ngày)
24

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của unclecode/crawl4ai

Tất cả issue của unclecode/crawl4ai

Issue tương tự

Thêm issue về Python

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.