-
-
Notifications
You must be signed in to change notification settings - Fork 386
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
Remove document cache after a certain inactivity #1494
Comments
The "Housekeeper" might be a natural place for this code to live: grist-core/app/gen-server/lib/Housekeeper.ts Lines 29 to 41 in ec0b885
It may be simpler than other housekeeping tasks, since it is scoped to an individual doc worker. |
I thought of this place as well. But I have rather considered adding a timer in ActiveDoc for these reasons:
If that makes sense, otherwise I would be glad to hear your feedback :). |
Hmm you'll need to work carefully. When a document is unused for some time, its It is possible to add a new state to ActiveDoc, but it will need a good mental model to avoid breaking interactions with DocManager and other classes. Definitely doable but be prepared for adventures. |
The bulk of RAM is held by the sandbox associated with the ActiveDoc so holding ActiveDocs around after sandboxes shut down is certainly not ruled out, just a significant change. |
Oh, I see, a shutdown unregisters the ActiveDoc from the DocManager, which means, if I am correct, that reopening the document after that would mean create a new instance of ActiveDoc. I thought the ActiveDoc instance would be reused. Now using Housekeeper makes total sense to me. Thank you @paulfitz! |
Describe the problem to be solved
Currently, in a multi-workers architecture, the
/persist
folder is filled of documents that has been loaded. This cache is only removed after a doc worker restart.Describe the solution you would like
It would be neat that once the document has been closed, and after a certain time of inactivity the local copy in
/persist
is deleted.If in the meantime (so after a document has been closed) there is some activity, the document is loaded again and the timer for wiping the local cache is disabled.
The text was updated successfully, but these errors were encountered: