Comments (9)
maybe add a mechanism to generate an event before shutdown, so sagas will be able to reverse any long transaction ?
from commanded.
It doesn't make sense that aggregates emit events because they haven't been receiving commands lately.
from commanded.
yep, agree. there are two reasons to shutdown, or the business process was finished, or we need more memory, and that aggregate has been sparsely used. for the first, the PM could shutdown them sending stop commands, but for the former, the solution above is fine. an algorithm could calculate the desired "cache" memory, and sets the best timeout based on memory needs
from commanded.
I guess that this is one of those cases that depends on the use case. Providing configurable timeouts would probably suffice. It's just a matter of finding a good value for your application.
from commanded.
Hibernating after a timeout could also be a good idea, since it will reduce memory to be as small as possible. You could probably have a timeout handler that registers (probably in ETS/Registry) the process somewhere as "in hibernation", with the current time, then have some sort of reaper that decides when to kill/shutdown processes. This is a common issue in actor languages, and why Pony was built to allow garbage collecting the actors themselves, which seems like a pretty rare/one of a kind ability.
from commanded.
@bbhoss GenServer already has support for handling timeouts. You can return a timeout
(in milliseconds) as part of the reply to handle_cast
and handle_call
requests. If there are no subsequent requests within the given timeout period, the GenServer will receive a :timeout
message and can be stopped.
It just needs to be implemented for the aggregate GenServer.
from commanded.
I understand that, what I'm proposing is in the timeout message handler, we register as hibernated, then return a :hibernate
tuple. Then a configurable reaper could evict the processes later.
from commanded.
Done in #57.
from commanded.
Published to Hex as v0.11.0
from commanded.
Related Issues (20)
- Process manager router option not working
- Lessons learned from performance optimization - an unlikely culprit HOT 3
- no function clause matching in Commanded.Commands.Dispatcher.telemetry_stop/3 HOT 1
- Docs questions
- Stacktrace in event handler error? HOT 2
- Paralelization Strategies in EventHandlers
- Should Commanded.Event.Handler support messages from swarm? HOT 2
- Event retention policies?
- please support multiple commanded application with one eventstore HOT 6
- Process Manager state serialization breaks when using a custom TypeProvider with the JsonSerializer
- `Commanded.ProcessManagers.ProcessManager.identity/0` function returns `nil` in unit tests
- no function clause matching in Commanded.Event.Handler.partition_event/4 HOT 1
- EventstoreDB is sunsetting the TCP protocol HOT 1
- Is it a bad practice for an event handler to depend on a projector completion? HOT 2
- Snapshotting 2 Aggregates having same identity
- Is it possible to log contents of InMemoryEventStore on failed test?
- Ecto Sandbox, Projections and In Memory adapter HOT 3
- Aggregate throws error when execute returns more than 1000 events.
- Individual stream events handling
- Skipped event with concurrency enabled HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from commanded.