You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Java] TaskInitializer.init() returns before model results are loaded; no readiness signal #17
The javadoc of TaskInitializer.init() says it "Initializes and executes all tasks in both stages", and the call blocks. However:
the model-result and bloom-filter tasks only schedule themselves (task/dataloading/ModelResultPeriodicLoadingTask.java:93, BloomFilterPeriodicLoadingTask.java:102);
their first run happens after a random delay of up to one full period (task/PeriodicTaskWithRandomizedStart.java:84), which is 300 s by default.
Until that first run, every evaluation sees no model and fails open. The README works around this with Thread.sleep(10000), which does not actually guarantee anything. There is also no API to ask whether DTE has loaded its data.
Proposed fix
init() runs the first load of the model-result and bloom-filter tasks before returning, within the existing overall.execution-timeout, and then continues periodic refresh with the existing randomized schedule.
Add boolean isReady() to BidRequestEvaluatorFactory, which is true once the configurations, the registries and the first model load have completed.
Remove the Thread.sleep(10000) advice from the README.
Compatibility
init() keeps its signature and timeout bound but may take longer to return, because it now does what its javadoc promises. isReady() is additive.
Test
Before the fix: immediately after init() returns (with a fake S3 that holds model data), the model cache is empty. After the fix: it is populated, and isReady() is true.
Activity
Add isReady() and document lazy model loading in the Java library (IA…