update unit test

This commit is contained in:
白茶清欢 2025-05-29 18:49:07 +08:00
parent efeeb51e8b
commit 029c268af6

View File

@ -23,7 +23,7 @@ var tw *TimeWheel
//
// Date : 17:00 2023/8/11
func TestNewTimeWheel(t *testing.T) {
tw = NewTimeWheel(10, 10*time.Second)
tw = NewTimeWheel(10, time.Second)
tw.AddTask(&Task{
Key: wrapper.StringFromRandom(32, "").Value(),
Interval: 5 * time.Second,
@ -36,8 +36,7 @@ func TestNewTimeWheel(t *testing.T) {
}, false)
go tw.Start()
time.Sleep(3 * time.Second)
for tw.IsRunning {
for tw.isRunning {
}
}
@ -61,7 +60,7 @@ func (t testTask) Callback(result *Result) error {
return nil
}
func (t testTask) Execute(ctx context.Context, cfg *Config) (map[string]any, error) {
func (t testTask) Execute(ctx context.Context, cfg *Config) *Result {
fmt.Println(wrapper.OwnTimeFromNow().ToString())
return nil, nil
return nil
}