@@ -300,11 +300,7 @@ func (s *visibilityStore) ListOpenWorkflowExecutions(
300
300
return nil , convertElasticsearchClientError ("ListOpenWorkflowExecutions failed" , err )
301
301
}
302
302
303
- isRecordValid := func (rec * store.InternalWorkflowExecutionInfo ) bool {
304
- return ! rec .StartTime .Before (request .EarliestStartTime ) && ! rec .StartTime .After (request .LatestStartTime )
305
- }
306
-
307
- return s .getListWorkflowExecutionsResponse (searchResult , request .Namespace , request .PageSize , isRecordValid )
303
+ return s .getListWorkflowExecutionsResponse (searchResult , request .Namespace , request .PageSize )
308
304
}
309
305
310
306
func (s * visibilityStore ) ListClosedWorkflowExecutions (
@@ -325,11 +321,7 @@ func (s *visibilityStore) ListClosedWorkflowExecutions(
325
321
return nil , convertElasticsearchClientError ("ListClosedWorkflowExecutions failed" , err )
326
322
}
327
323
328
- isRecordValid := func (rec * store.InternalWorkflowExecutionInfo ) bool {
329
- return ! rec .CloseTime .Before (request .EarliestStartTime ) && ! rec .CloseTime .After (request .LatestStartTime )
330
- }
331
-
332
- return s .getListWorkflowExecutionsResponse (searchResult , request .Namespace , request .PageSize , isRecordValid )
324
+ return s .getListWorkflowExecutionsResponse (searchResult , request .Namespace , request .PageSize )
333
325
}
334
326
335
327
func (s * visibilityStore ) ListOpenWorkflowExecutionsByType (
@@ -352,11 +344,7 @@ func (s *visibilityStore) ListOpenWorkflowExecutionsByType(
352
344
return nil , convertElasticsearchClientError ("ListOpenWorkflowExecutionsByType failed" , err )
353
345
}
354
346
355
- isRecordValid := func (rec * store.InternalWorkflowExecutionInfo ) bool {
356
- return ! rec .StartTime .Before (request .EarliestStartTime ) && ! rec .StartTime .After (request .LatestStartTime )
357
- }
358
-
359
- return s .getListWorkflowExecutionsResponse (searchResult , request .Namespace , request .PageSize , isRecordValid )
347
+ return s .getListWorkflowExecutionsResponse (searchResult , request .Namespace , request .PageSize )
360
348
}
361
349
362
350
func (s * visibilityStore ) ListClosedWorkflowExecutionsByType (
@@ -378,11 +366,7 @@ func (s *visibilityStore) ListClosedWorkflowExecutionsByType(
378
366
return nil , convertElasticsearchClientError ("ListClosedWorkflowExecutionsByType failed" , err )
379
367
}
380
368
381
- isRecordValid := func (rec * store.InternalWorkflowExecutionInfo ) bool {
382
- return ! rec .CloseTime .Before (request .EarliestStartTime ) && ! rec .CloseTime .After (request .LatestStartTime )
383
- }
384
-
385
- return s .getListWorkflowExecutionsResponse (searchResult , request .Namespace , request .PageSize , isRecordValid )
369
+ return s .getListWorkflowExecutionsResponse (searchResult , request .Namespace , request .PageSize )
386
370
}
387
371
388
372
func (s * visibilityStore ) ListOpenWorkflowExecutionsByWorkflowID (
@@ -405,11 +389,7 @@ func (s *visibilityStore) ListOpenWorkflowExecutionsByWorkflowID(
405
389
return nil , convertElasticsearchClientError ("ListOpenWorkflowExecutionsByWorkflowID failed" , err )
406
390
}
407
391
408
- isRecordValid := func (rec * store.InternalWorkflowExecutionInfo ) bool {
409
- return ! rec .StartTime .Before (request .EarliestStartTime ) && ! rec .StartTime .After (request .LatestStartTime )
410
- }
411
-
412
- return s .getListWorkflowExecutionsResponse (searchResult , request .Namespace , request .PageSize , isRecordValid )
392
+ return s .getListWorkflowExecutionsResponse (searchResult , request .Namespace , request .PageSize )
413
393
}
414
394
415
395
func (s * visibilityStore ) ListClosedWorkflowExecutionsByWorkflowID (
@@ -431,11 +411,7 @@ func (s *visibilityStore) ListClosedWorkflowExecutionsByWorkflowID(
431
411
return nil , convertElasticsearchClientError ("ListClosedWorkflowExecutionsByWorkflowID failed" , err )
432
412
}
433
413
434
- isRecordValid := func (rec * store.InternalWorkflowExecutionInfo ) bool {
435
- return ! rec .CloseTime .Before (request .EarliestStartTime ) && ! rec .CloseTime .After (request .LatestStartTime )
436
- }
437
-
438
- return s .getListWorkflowExecutionsResponse (searchResult , request .Namespace , request .PageSize , isRecordValid )
414
+ return s .getListWorkflowExecutionsResponse (searchResult , request .Namespace , request .PageSize )
439
415
}
440
416
441
417
func (s * visibilityStore ) ListClosedWorkflowExecutionsByStatus (
@@ -456,11 +432,7 @@ func (s *visibilityStore) ListClosedWorkflowExecutionsByStatus(
456
432
return nil , convertElasticsearchClientError ("ListClosedWorkflowExecutionsByStatus failed" , err )
457
433
}
458
434
459
- isRecordValid := func (rec * store.InternalWorkflowExecutionInfo ) bool {
460
- return ! rec .CloseTime .Before (request .EarliestStartTime ) && ! rec .CloseTime .After (request .LatestStartTime )
461
- }
462
-
463
- return s .getListWorkflowExecutionsResponse (searchResult , request .Namespace , request .PageSize , isRecordValid )
435
+ return s .getListWorkflowExecutionsResponse (searchResult , request .Namespace , request .PageSize )
464
436
}
465
437
466
438
func (s * visibilityStore ) ListWorkflowExecutions (
@@ -486,7 +458,7 @@ func (s *visibilityStore) ListWorkflowExecutions(
486
458
return nil , convertElasticsearchClientError ("ListWorkflowExecutions failed" , err )
487
459
}
488
460
489
- return s .getListWorkflowExecutionsResponse (searchResult , request .Namespace , request .PageSize , nil )
461
+ return s .getListWorkflowExecutionsResponse (searchResult , request .Namespace , request .PageSize )
490
462
}
491
463
492
464
func (s * visibilityStore ) ScanWorkflowExecutions (
@@ -543,7 +515,7 @@ func (s *visibilityStore) scanWorkflowExecutionsWithPit(
543
515
}
544
516
}
545
517
546
- return s .getListWorkflowExecutionsResponse (searchResult , request .Namespace , request .PageSize , nil )
518
+ return s .getListWorkflowExecutionsResponse (searchResult , request .Namespace , request .PageSize )
547
519
}
548
520
549
521
func (s * visibilityStore ) scanWorkflowExecutionsWithScroll (ctx context.Context , request * manager.ListWorkflowExecutionsRequestV2 ) (* store.InternalListWorkflowExecutionsResponse , error ) {
@@ -584,7 +556,7 @@ func (s *visibilityStore) scanWorkflowExecutionsWithScroll(ctx context.Context,
584
556
}
585
557
}
586
558
587
- return s .getListWorkflowExecutionsResponse (searchResult , request .Namespace , request .PageSize , nil )
559
+ return s .getListWorkflowExecutionsResponse (searchResult , request .Namespace , request .PageSize )
588
560
}
589
561
590
562
func (s * visibilityStore ) CountWorkflowExecutions (
@@ -777,7 +749,6 @@ func (s *visibilityStore) getListWorkflowExecutionsResponse(
777
749
searchResult * elastic.SearchResult ,
778
750
namespace namespace.Name ,
779
751
pageSize int ,
780
- isRecordValid func (rec * store.InternalWorkflowExecutionInfo ) bool ,
781
752
) (* store.InternalListWorkflowExecutionsResponse , error ) {
782
753
783
754
if searchResult .Hits == nil || len (searchResult .Hits .Hits ) == 0 {
@@ -798,14 +769,8 @@ func (s *visibilityStore) getListWorkflowExecutionsResponse(
798
769
if err != nil {
799
770
return nil , err
800
771
}
801
- // ES6 uses "date" data type not "date_nanos". It truncates dates using milliseconds and might return extra rows.
802
- // For example: 2021-06-12T00:21:43.159739259Z fits 2021-06-12T00:21:43.158Z...2021-06-12T00:21:43.159Z range lte/gte query.
803
- // Therefore, these records need to be filtered out on the client side to support nanos precision.
804
- // After ES6 deprecation isRecordValid can be removed.
805
- if isRecordValid == nil || isRecordValid (workflowExecutionInfo ) {
806
- response .Executions = append (response .Executions , workflowExecutionInfo )
807
- lastHitSort = hit .Sort
808
- }
772
+ response .Executions = append (response .Executions , workflowExecutionInfo )
773
+ lastHitSort = hit .Sort
809
774
}
810
775
811
776
if len (searchResult .Hits .Hits ) == pageSize && lastHitSort != nil { // this means the response is not the last page
0 commit comments