mirror of
https://github.com/c9s/bbgo.git
synced 2024-11-10 09:11:55 +00:00
batch: fix time range checking
This commit is contained in:
parent
8c1198de83
commit
4556e501da
|
@ -94,10 +94,8 @@ func (q *AsyncTimeRangedBatchQuery) Query(ctx context.Context, ch interface{}, s
|
|||
item := listRef.Index(i)
|
||||
entryTime := q.T(item.Interface())
|
||||
|
||||
if entryTime.Before(startTime) {
|
||||
continue
|
||||
}
|
||||
if entryTime.After(endTime) {
|
||||
// inclusive time selection
|
||||
if startTime.After(entryTime) || endTime.Before(entryTime) {
|
||||
continue
|
||||
}
|
||||
|
||||
|
|
|
@ -70,7 +70,7 @@ func (sel SyncTask) execute(ctx context.Context, db *sqlx.DB, startTime time.Tim
|
|||
|
||||
ids := buildIdMap(sel, recordSliceRef)
|
||||
|
||||
if err := sortRecords(sel, recordSliceRef); err != nil {
|
||||
if err := sortRecordsAscending(sel, recordSliceRef); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
|
@ -177,7 +177,7 @@ func lastRecordTime(sel SyncTask, recordSlice reflect.Value, defaultTime time.Ti
|
|||
return since
|
||||
}
|
||||
|
||||
func sortRecords(sel SyncTask, recordSlice reflect.Value) error {
|
||||
func sortRecordsAscending(sel SyncTask, recordSlice reflect.Value) error {
|
||||
if sel.Time == nil {
|
||||
return errors.New("time field is not set, can not sort records")
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user