Skip to content

Commit

Permalink
Updated readme
Browse files Browse the repository at this point in the history
  • Loading branch information
ncthbrt committed Dec 4, 2017
1 parent 1cbb89c commit 6ce6bd7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -542,7 +542,20 @@ The final argument to `spawnPersistent` is the actor properties object. Here we

### Timeouts

While not strictly a part of the persistent actor, timeouts are frequently used with snapshotting. Actors take up memory, which is still a limited resource. If an actor has not processed messages in a while, it makes sense to shut it down until it is again needed; this frees up memory. Adding a timeout to the user
While not strictly a part of the persistent actor, timeouts are frequently used with snapshotting. Actors take up memory, which is still a limited resource. If an actor has not processed messages in a while, it makes sense to shut it down until it is again needed; this frees up memory. Adding a timeout to the user contacts service is similar to snapshotting:

```js
const spawnUserContactService = (parent, userId) => spawnPersistent(
parent,
// Same function as before
async (state = { contacts:{} }, msg, ctx) => {},
`contacts:${userId}`,
userId,
{ snapshot: every(20).messages.or(12).hours,
timeout: after(10).minutes
}
);
```



Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nact",
"version": "4.0.0",
"version": "4.0.1",
"description": "nact ⇒ node.js + actors = your services have never been so µ",
"main": "lib/index.js",
"scripts": {
Expand Down

0 comments on commit 6ce6bd7

Please sign in to comment.