Skip to content

Commit 5ee388c

Browse files
committed
This adds a ticker mode to ScheduledDataLoaderRegistry - testing works bitches! More doco based on PR feedback
1 parent 1d11d87 commit 5ee388c

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

README.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -653,6 +653,26 @@ You will want to look at sharing the `ScheduledExecutorService` in some way betw
653653
otherwise you will be creating a thread per `ScheduledDataLoaderRegistry` instance created and with enough concurrent requests
654654
you may create too many threads.
655655

656+
### ScheduledDataLoaderRegistry dispatching algorithm
657+
658+
When ticker mode is **false** the `ScheduledDataLoaderRegistry` algorithm is as follows :
659+
660+
* Nothing starts scheduled - some code must call `registry.dispatchAll()` a first time
661+
* Then for every `DataLoader` in the registry
662+
* The `DispatchPredicate` is called to test if the data loader should be dispatched
663+
* if it returns **false** then a task is scheduled to re-evaluate this specific dataloader in the near future
664+
* If it returns **true**, then `dataLoader.dispatch()` is called and the dataloader is not rescheduled again
665+
* The re-evaluation tasks are run periodically according to the `registry.getScheduleDuration()`
666+
667+
When ticker mode is **true** the `ScheduledDataLoaderRegistry` algorithm is as follows:
668+
669+
* Nothing starts scheduled - some code must call `registry.dispatchAll()` a first time
670+
* Then for every `DataLoader` in the registry
671+
* The `DispatchPredicate` is called to test if the data loader should be dispatched
672+
* if it returns **false** then a task is scheduled to re-evaluate this specific dataloader in the near future
673+
* If it returns **true**, then `dataLoader.dispatch()` is called **and** a task is scheduled to re-evaluate this specific dataloader in the near future
674+
* The re-evaluation tasks are run periodically according to the `registry.getScheduleDuration()`
675+
656676
## Other information sources
657677

658678
- [Facebook DataLoader Github repo](https://github.com/facebook/dataloader)

0 commit comments

Comments
 (0)