update unit test
This commit is contained in:
parent
efeeb51e8b
commit
029c268af6
@ -23,7 +23,7 @@ var tw *TimeWheel
|
|||||||
//
|
//
|
||||||
// Date : 17:00 2023/8/11
|
// Date : 17:00 2023/8/11
|
||||||
func TestNewTimeWheel(t *testing.T) {
|
func TestNewTimeWheel(t *testing.T) {
|
||||||
tw = NewTimeWheel(10, 10*time.Second)
|
tw = NewTimeWheel(10, time.Second)
|
||||||
tw.AddTask(&Task{
|
tw.AddTask(&Task{
|
||||||
Key: wrapper.StringFromRandom(32, "").Value(),
|
Key: wrapper.StringFromRandom(32, "").Value(),
|
||||||
Interval: 5 * time.Second,
|
Interval: 5 * time.Second,
|
||||||
@ -36,8 +36,7 @@ func TestNewTimeWheel(t *testing.T) {
|
|||||||
}, false)
|
}, false)
|
||||||
go tw.Start()
|
go tw.Start()
|
||||||
time.Sleep(3 * time.Second)
|
time.Sleep(3 * time.Second)
|
||||||
for tw.IsRunning {
|
for tw.isRunning {
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -61,7 +60,7 @@ func (t testTask) Callback(result *Result) error {
|
|||||||
return nil
|
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())
|
fmt.Println(wrapper.OwnTimeFromNow().ToString())
|
||||||
return nil, nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user