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

Refactor out state delta handling into its own class #4917

Merged
merged 5 commits into from
Mar 25, 2019

Conversation

hawkowl
Copy link
Contributor

@hawkowl hawkowl commented Mar 22, 2019

The new stats module uses some of the common components, so it's broken up into its own module.

@hawkowl hawkowl requested a review from a team March 22, 2019 11:47
@codecov
Copy link

codecov bot commented Mar 22, 2019

Codecov Report

Merging #4917 into develop will increase coverage by <.01%.
The diff coverage is 87.5%.

@@             Coverage Diff             @@
##           develop    #4917      +/-   ##
===========================================
+ Coverage    78.01%   78.02%   +<.01%     
===========================================
  Files          326      328       +2     
  Lines        34058    34067       +9     
  Branches      5621     5620       -1     
===========================================
+ Hits         26572    26581       +9     
- Misses        5867     5868       +1     
+ Partials      1619     1618       -1

synapse/handlers/user_directory.py Outdated Show resolved Hide resolved
logger = logging.getLogger(__name__)


class UserDirectoryHandler(object):
class UserDirectoryHandler(StateDeltasHandler):
Copy link
Member

Choose a reason for hiding this comment

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

composition > inheritance for this sort of thing, imho

Copy link
Contributor Author

Choose a reason for hiding this comment

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

sure, that could be a good refactor later. Right now, I'm just splitting up what Matthew wrote.

Copy link
Member

Choose a reason for hiding this comment

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

I don't think it will happen later. I'm not too bothered about this particular nit, but as a general principle, I don't think that we should be merging stuff into develop which wouldn't normally pass review just because Matthew wrote it in a hurry.

I'm sorry if you've been given a pile of code to try and sort out, but I am strongly averse to adding to our technical debt by adding essentially unreviewed code to develop.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sure, that's why this code is being reviewed. And, yes, I am a staunch believer in the composition > inheritance thing, which -- if I wrote it -- I might well have investigated how to do it. But, I didn't write it, but the code works, and it matches the rest of the inheritance-based storage/handler APIs, so there's no reason going back and thinking about how to make this API composition-friendly if we're not doing it across everything else that's inheritance based.

Copy link
Member

Choose a reason for hiding this comment

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

my impression was that changing to composition here would be approximately a three line change, but if it's more complicated than that, I'm happy to concede.

synapse/storage/state_deltas.py Outdated Show resolved Hide resolved
synapse/storage/state_deltas.py Outdated Show resolved Hide resolved
synapse/storage/state_deltas.py Outdated Show resolved Hide resolved
synapse/handlers/state_deltas.py Outdated Show resolved Hide resolved
@hawkowl hawkowl requested a review from a team March 22, 2019 19:38
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

@hawkowl hawkowl merged commit ac396a0 into develop Mar 25, 2019
anoadragon453 added a commit that referenced this pull request Mar 26, 2019
* develop: (141 commits)
  Make federation endpoints more tolerant of trailing slashes v2 (#4935)
  Fix ClientReplicationStreamProtocol.__str__ (#4929)
  Fix bug where read-receipts lost their timestamps (#4927)
  Use an explicit dbname for postgres connections in the tests. (#4928)
  Fix nginx example in ACME doc. (#4923)
  Refactor out state delta handling into its own class (#4917)
  Newsfile
  Use yaml safe_load
  Allow newsfragments to end with exclamation marks! (#4912)
  Some more porting to HomeserverTestCase and remove old RESTHelper (#4913)
  Clean up backoff_on_404 and metehod calls
  Update changelog.d/4908.bugfix
  Update Apache Setup To Remove Location Syntax (#4870)
  isort
  Newsfile
  Fix typo and add description
  Deny peeking into rooms that have been blocked
  Rejig testcase to make it more extensible
  Remove debug
  Add tests
  ...
@hawkowl hawkowl deleted the hawkowl/state-deltas-refactor branch May 21, 2019 15:56
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