Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Further fixes to context handling in LookupResources and performance improvements #1397

Merged
merged 2 commits into from
Jun 19, 2023

Commits on Jun 16, 2023

  1. Redo how context is handled around limits

    The previous approach of having the limit tracker control the context was causing parallelized branches of the Reachable Resources to be canceled early; we were ignoring this error (incorrectly) and thus, reachable resources could return partial results.
    
    Instead, we now manually and explicitly detach the context and cancel it explicitly when no further dispatching is needed.
    josephschorr committed Jun 16, 2023
    Configuration menu
    Copy the full SHA
    28f9ccd View commit details
    Browse the repository at this point in the history
  2. Parallelize the chunked dispatches in reachable resources

    This changes the datastore query to no longer have a limit, and instead produce a series of chunks for parallelized processing using the same parallelization code as the entrypoint cursor parallelization system.
    
    This is done in service of performance: a single database query is faster than making multiple roundtrips.
    
    This change also removes the limits on dispatching reachable resources and lookup resources in favor of grabbing as many results as possible and canceling dispatch once the overall limit has been reached. While this results in slightly more work being done than is necessary, it is far more performant from the caller's perspective (especially for no-limit calls), because there is no need to re-enter the reachable resources dispatch tree.
    
    As per the above change around limits, this change also further adjusts how context cancelation functions and adds a slew of tests to cover these new cases
    josephschorr committed Jun 16, 2023
    Configuration menu
    Copy the full SHA
    2937947 View commit details
    Browse the repository at this point in the history