Report a failed connection to Ollama as server_unreachable, not timeout

Đang mở Phù hợp với người mới
#73 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
86/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ệ
go, ollama
Lĩnh vực
backend, cli

Hướng nghiên cứu

Đọc internal/ollama/ollama.go và các bài kiểm thử hiện có trong internal/ollama sử dụng httptest. Kiểm tra cách Chat phân loại lỗi hết thời gian chờ, sau đó thêm bài kiểm thử cho một lần kết nối hết thời gian chờ và một máy chủ chấp nhận kết nối nhưng không phản hồi; giữ bài kiểm thử kết nối dưới một giây. Công việc hoàn tất khi hai trường hợp lần lượt trả về lỗi khớp với ErrUnreachable và ErrTimeout, đồng thời make check chạy thành công.

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

Mô tả

bench good first issue

What

When the Ollama host is down or unreachable, the TCP connection never opend and go will give up. MetCode reports this as "timeout" yet this is not specific enough for our case. We should report this as server_unreachable instead.

Where

The cause is in internal/ollama/ollama.go, in Chat: any net.Error with Timeout() == true becomes ErrTimeout, including a failed dial.

Fix

Before the Timeout() check, detect a failed dial and return ErrUnreachable instead. A dial failure is a *net.OpError with Op == "dial" (use errors.As).

Done when

  • A request that cannot connect returns an error that errors.Is(err, ollama.ErrUnreachable) accepts, even when the dial timed out.
  • A server that accepts the connection but never answers still returns ErrTimeout.
  • There is a test for each case. internal/ollama tests already fake servers with httptest. For the dial case, a listener that accepts nothing, or a short Client timeout against a non-routable address, works. Keep the test under a second.
  • make check passes.
Ngôn ngữ chính
Go
Star
1
Fork
2
Merge trung bình
12 giờ 55 phút
Pull request đã merge (30 ngày)
18

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 Edwin-metcalf/MetCode

Tất cả issue của Edwin-metcalf/MetCode

Issue tương tự

Thêm issue về Go

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.