Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Only get cached state from context in persist_event #3584

Merged
merged 3 commits into from
Jul 23, 2018

Conversation

erikjohnston
Copy link
Member

We don't want to bother pulling out the current state from the DB since
until we know we have to. Checking the context for state is just an
optimisation.

We don't want to bother pulling out the current state from the DB since
until we know we have to. Checking the context for state is just an
optimisation.
Copy link
Member

@richvdh richvdh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm otherwise


Returns:
dict[(str, str), str]|None: Returns None if state_group
is None, which happens when the associated event is an outlier.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... or if we don't have a cache, presumably

state_groups_map[ctx.state_group] = yield ctx.get_current_state_ids(self)
current_state_ids = ctx.get_cached_current_state_ids()
if current_state_ids is not None:
state_groups_map[ctx.state_group] = current_state_ids
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could do with a comment here

@richvdh richvdh assigned erikjohnston and unassigned richvdh Jul 23, 2018
@erikjohnston erikjohnston merged commit f559119 into develop Jul 23, 2018
@erikjohnston erikjohnston deleted the erikj/use_cached branch September 20, 2018 13:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants