Skip to content

Conversation

@sbehak-trr
Copy link

@sbehak-trr sbehak-trr commented Feb 12, 2026

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.

@sbehak-trr sbehak-trr marked this pull request as ready for review February 12, 2026 17:33
def flush(page)
filename = filename_for_page(page)
doc = build_xml_for_page(paginator.items(page))
def flush
Copy link

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?

Copy link
Author

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.

@sbehak-trr sbehak-trr requested a review from a team February 12, 2026 20:48
Copy link

@johnholdun johnholdun left a 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants