-
Notifications
You must be signed in to change notification settings - Fork 15
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
Parser and processor fixes #166
Conversation
…ow missing from the DB
@@ -69,7 +77,7 @@ <h2 class="eventlist_header">{{title[object] | safe}}</h2> | |||
<div class="eventdescription"> | |||
<span class="dateblock">{% if event["is_active"] %}(A){% endif %} {{event["start_date"]}}{% if event["end_date"] != null %} - {{event["end_date"]}}{%endif%}:</span> | |||
<span class="eventtext"> | |||
{{ event["leader"].leader_class.capitalize() }} {{ links[event["leader"]] | safe }} ruled the {{ links[event["country"]] | safe}} | |||
{{ render_leader(event, "An unknown leader") }} ruled the {{ links[event["country"]] | safe}} |
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.
a couple things I'm not sure about in this template language is, one, why pass "An unknown leader" when the fallback of "an unknown leader" exists? is this passing a specific fallback string to capitalized "an"?
two, does it still work with the seemingly keyword argument in the macro vs the positional argument in these calls?
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.
Yeah, that's just capitalization
The macro syntax is similar to functions in python: you can pass arguments by position or name
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.
Thanks, I'm not sure I remembered one could pass keyword arguments by position, but it's not too complicated here at least
@@ -72,6 +72,7 @@ def process_gamestate(self, game_id: str, gamestate_dict: Dict[str, Any]): | |||
) | |||
if config.CONFIG.debug_mode or isinstance(e, KeyboardInterrupt): | |||
raise e | |||
_shared_description_cache.clear() |
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.
I'm curious how you found what was leaking memory?
And remind me of the flow please - is the cache built while parsing a save, then this line clears it after one save is parsed, to free that memory?
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.
I'm curious how you found what was leaking memory?
Nothing fancy. I'm remembered that was a relatively recent change, so I tried disabling the cache entirely, and that fixed the memory leak. Then I experimented to find a way to keep the cache (since that significantly increased speed) but not leak memory
The cache is gradually built up as the function is used, then cleared when we're done processing a save. I'll add a comment in the code here
This fixes 3 issues:
Not a Number
Parse Error #164Also bumps up the Stellaris version number in the mod descriptor (already updated on workshop)