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

Process manager idle process timeout #290

Merged
merged 1 commit into from
Jun 13, 2019

Conversation

slashdotdash
Copy link
Member

Every started instance of a process manager runs indefinitely. To reduce memory usage this pull request adds an idle timeout configuration (in milliseconds) after which an instance process will be shutdown.

The process will be restarted on demand, whenever an event is routed to it, and its state will be rehydrated from the instance snapshot.

Example

Define the idle_timeout option in the process manager module:

defmodule ExampleProcessManager do
  use Commanded.ProcessManagers.ProcessManager,
    name: "ExampleProcessManager",
    router: ExampleRouter,
    idle_timeout: :timer.minutes(10)
end

Or provide the timeout on start:

ExampleProcessManager.start_link(idle_timeout: 10_000)

By default the idle timeout will be configured as :infinity so every process manager instance will run indefinitely once started.

Fixes #148.

@slashdotdash slashdotdash merged commit b057c33 into releases/v0.17 Jun 13, 2019
@slashdotdash slashdotdash deleted the feature/process-manager-idle-timeout branch June 13, 2019 14:37
slashdotdash added a commit that referenced this pull request Jun 13, 2019
Include #290 in CHANGELOG.
slashdotdash added a commit that referenced this pull request Jun 13, 2019
Include #290 in CHANGELOG.
@slashdotdash
Copy link
Member Author

Published to Hex as v0.18.1 and v0.17.5 releases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant