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:

let createContactsService = (parent, userId) =>
    ~key="contacts" ++ userId,
    ~shutdownAfter=15 * minutes,
    ~snapshotEvery=10 * messages,
    (state, (sender, msg), {persist}) => {
      /* Same function as before */
    (ctx) => {contacts: ContactIdMap.empty, seqNumber: 0}