-
Notifications
You must be signed in to change notification settings - Fork 0
Growth 1304 fix memory issue #5
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
base: main
Are you sure you want to change the base?
Conversation
| def flush(page) | ||
| filename = filename_for_page(page) | ||
| doc = build_xml_for_page(paginator.items(page)) | ||
| def flush |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same here, why not just keep using flush(page) and when needed send current_page as the value of that param?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here I'm not so sure, because I need to update the value of @current_page as well and it's not a good idea to modify the value of an input param. Also, it doesn't make sense to "flush" pages other than the current page, because we are dropping them as soon as they are processed.
johnholdun
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems good, but unless I'm mistaken, Paginator is no longer needed here. It's being recreated every time its collection reaches the limit, so it will always only return one page of results, and thus could be replaced by an array.
GROWTH-1304
Description
Previously, each time we loaded the max amount of urls per file (defined by the @max_urls config variable) we generated a new sitemap file and released the memory, then we repeated the process until all urls were processed. This allowed us to load a huge amount of urls without clogging all our memory.
At some point this feature was lost and sitemap files started to be generated only at the very end of the process. This means that the process starts to accumulate more and more memory and if there's too many urls to process we get a memory overload error.
This PR fixes the issue by restoring the capability to generate sitemap files each time we reach the limit defined by the @max_urls config variable.