Make the clock replaceable for tests

Đang mở
#60 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ó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
40/100
Loại issue
Tính năng
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
csharp
Lĩnh vực
backend, testing

Hướng nghiên cứu

Start at src/TickerNet.Utilities/Interfaces/ITickerClock.cs and the AddTickerNet registration that wires it as a singleton, then grep src/ for DateTime.UtcNow and DateTime.Now to enumerate every scheduling decision still reading the wall clock, especially the background services and the execution path. Decide whether to thread ITickerClock through or adapt .NET's TimeProvider, noting the ADR required in site/decisions/ for any public API change. Done when the grep finds no scheduling decisions outside the clock, a fake-clock test advances time and sees a due job fire, and the docs show registering your own clock after AddTickerNet.

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

Mô tả

.NET enhancement help wanted roadmap

What's missing

ITickerClock (src/TickerNet.Utilities/Interfaces/ITickerClock.cs) is public and registered as a singleton, and the managers and persistence providers use it. But the scheduler background services and parts of the execution path still read DateTime.UtcNow directly, and replacing the clock isn't documented or tested. So tests can't control time reliably.

Proposal

  • Use ITickerClock everywhere TickerNet reads the current time, or switch to .NET's TimeProvider and keep ITickerClock as an adapter.
  • Document that registering your own clock after AddTickerNet replaces the default, with an example for tests.
  • Add a test that moves a fake clock forward and checks that a due job runs.

Done when: a search for DateTime.UtcNow / DateTime.Now in src/ finds no scheduling decisions outside the clock, and the docs show how to replace it.


Part of the TickerQ comparison roadmap. Design it from this description only: never read or copy code, tests or docs from TickerQ 10.5.0 or later, which is under a commercial license (see CONTRIBUTING.md). If it adds or changes public API, add an ADR in site/decisions/ and list the API in the pull request. Comment here if you'd like to pick it up, and ask anything in Discussions.

Ngôn ngữ chính
C#
Star
0
Fork
2
Merge trung bình
1 giờ 8 phút
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 TickerNet/TickerNet

Tất cả issue của TickerNet/TickerNet

Issue tương tự

Thêm issue về C#

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.