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

Throttles/rework run and sending logic #180

Merged
merged 13 commits into from
Jan 18, 2024

Commits on Jan 17, 2024

  1. Spacing issue

    NelsonVides committed Jan 17, 2024
    Configuration menu
    Copy the full SHA
    9952d01 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    b674ab0 View commit details
    Browse the repository at this point in the history
  3. Reimplement throttler run

    NelsonVides committed Jan 17, 2024
    Configuration menu
    Copy the full SHA
    6fa979e View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    ac8196e View commit details
    Browse the repository at this point in the history
  5. Implement send_and_wait as a blocking gen_server:call/3

    Notice that a normal send would spawn a local process, send a pid across
    distribution, have the local process receive an atom across distribution, and
    have the `Msg' be delivered to the requester locally.
    
    That is 1 pid and 1 atom across distribution and one local payload, plus one
    spawn that copies the payload.
    
    Doing a call instead will only send back and forth the payload, and already
    solve monitoring problems
    
    This is specially optimal when the payload is a literal, like an atom.
    NelsonVides committed Jan 17, 2024
    Configuration menu
    Copy the full SHA
    6db5510 View commit details
    Browse the repository at this point in the history
  6. Fail if async_runner died unexpectedly

    Note that in this case, the desired operation will never happen,
    and therefore the test has been deemed invalid.
    NelsonVides committed Jan 17, 2024
    Configuration menu
    Copy the full SHA
    7204660 View commit details
    Browse the repository at this point in the history

Commits on Jan 18, 2024

  1. Extract async_runner logic

    We here revert the changes of the previous commits and instead move the logic
    regarding the `async_runner` to a separate module.
    
    This way, the `amoc_throttle_process`'s only responsibility is to track runners
    and notify them that they can run; the `amoc_throttle_controller`'s only
    responsibility is to assign tasks to processes and control the rates; and
    `amoc_throttle_runner`'s only responsibility is to execute the actions.
    NelsonVides committed Jan 18, 2024
    Configuration menu
    Copy the full SHA
    fa4df82 View commit details
    Browse the repository at this point in the history
  2. Encapsulate creating throttle runners outside of throttle process

    With this, now `amoc_throttle_process` only tracks the runners and doesn't know
    about creating them nor about what operation is it running, and the controller
    now only controls the rate, and not the choosing of a worker.
    NelsonVides committed Jan 18, 2024
    Configuration menu
    Copy the full SHA
    dc76a5d View commit details
    Browse the repository at this point in the history
  3. Encapsulate specifics of throttling operations to the runner

    With this, now `amoc_throttle_runner` optimises the different use-cases of the
    throttling API: executing arbitrary code, sending a payload, or blocking the
    caller.
    NelsonVides committed Jan 18, 2024
    Configuration menu
    Copy the full SHA
    3959d8d View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    8670b75 View commit details
    Browse the repository at this point in the history
  5. Test async runner death

    NelsonVides committed Jan 18, 2024
    Configuration menu
    Copy the full SHA
    1e25a29 View commit details
    Browse the repository at this point in the history
  6. Apply review

    NelsonVides committed Jan 18, 2024
    Configuration menu
    Copy the full SHA
    ce5dde6 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    5060d89 View commit details
    Browse the repository at this point in the history