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

Separated Statistics [3/7ish] #5890

Merged
merged 11 commits into from
Aug 28, 2019
Merged

Separated Statistics [3/7ish] #5890

merged 11 commits into from
Aug 28, 2019

Conversation

reivilibre
Copy link
Contributor

@reivilibre reivilibre commented Aug 20, 2019

Signed-off-by: Olivier Wilkinson (reivilibre) [email protected]

This PR is the third in a series of PRs replacing #5847, which does the following:

  • Handle state deltas (state events) and turn them into stats deltas (and track room state)

These PRs will be merged into an intermediate branch (#5879) as some features may be broken if not all the PRs are applied at once.

Signed-off-by: Olivier Wilkinson (reivilibre) <[email protected]>
@reivilibre reivilibre requested a review from a team August 20, 2019 13:25
@reivilibre reivilibre changed the title Handle state deltas and turn them into stats deltas Separated Statistics [3/7ish] Aug 20, 2019
Copy link
Member

@erikjohnston erikjohnston left a comment

Choose a reason for hiding this comment

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

Some basic thoughts, mostly nits. I do think we should probably consider dumping the concept of "is_public", and instead let the consumer of the stats figure it out.

room_stats_complete = True

elif typ == EventTypes.JoinRules:
old_room_state = yield self.store.get_room_state(room_id)
Copy link
Member

Choose a reason for hiding this comment

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

This is probably going to be more up to date room state?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As discussed IRL (I think – lmk if mistaken), this should be fine, as the line underneath is responsible for updating the room_stats_state table upon which this (commented) line depends.

@@ -103,6 +193,26 @@ def update_room_state(self, room_id, fields):
desc="update_room_state",
)

@cached()
def get_earliest_token_for_stats(self, stats_type, id):
Copy link
Member

Choose a reason for hiding this comment

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

Does this cache not need to be invalidated?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I believe I have addressed this — but please can you check this specifically before resolving this comment? I feel like it's something that could easily bite in the bum if it's not correct.

Signed-off-by: Olivier Wilkinson (reivilibre) <[email protected]>
`absolute_fields` being None shouldn't preclude completion of a current
stats row.

Signed-off-by: Olivier Wilkinson (reivilibre) <[email protected]>
Signed-off-by: Olivier Wilkinson (reivilibre) <[email protected]>
@reivilibre reivilibre removed the request for review from erikjohnston August 28, 2019 08:56
Copy link
Member

@erikjohnston erikjohnston left a comment

Choose a reason for hiding this comment

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

Mostly fine

@defer.inlineCallbacks
def _unsafe_process(self):
# If self.pos is None then means we haven't fetched it from DB
if self.pos is None or None in self.pos.values():
Copy link
Member

Choose a reason for hiding this comment

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

What does None in self.pos.values() mean?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Adding a comment.

Signed-off-by: Olivier Wilkinson (reivilibre) <[email protected]>
@reivilibre reivilibre merged commit 3cdce28 into rei/rss_target Aug 28, 2019
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