-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Refactor function parameters to describe the behavior instead of the state which is interpreted in non-obvious ways #11300
Comments
This issue strikes me as a bit open-ended: it essentially amounts to "make the codebase better", which is something that we can never, ever, call "done". It might be ok if the issue cited specific things that need changing, but in general I'd say that it's not worth tracking refactoring tasks like that in an issue: if it bothers you enough, Just F-ing Do It (most likely as part of other work in the area); it's unlikely we'd be able to schedule an issue like this in its own right. |
It's open ended but it still serves as a good reference for the rationale for us striving to get away from state-interpretations. I've added a definition of done to the description so we can close at some point. I planned on making some of these changes for the examples given at least. |
…ist_events_and_state_updates`) Part of #11300 Call stack: - `_persist_events_and_state_updates` (added `use_negative_stream_ordering`) - `_persist_events_txn` - `_update_room_depths_txn` (added `update_room_forward_stream_ordering`) - `_update_metadata_tables_txn` - `_store_room_members_txn` (added `inhibit_local_membership_updates`)
…rsist_events_and_state_updates`) (#11417) Part of #11300 Call stack: - `_persist_events_and_state_updates` (added `use_negative_stream_ordering`) - `_persist_events_txn` - `_update_room_depths_txn` (added `update_room_forward_stream_ordering`) - `_update_metadata_tables_txn` - `_store_room_members_txn` (added `inhibit_local_membership_updates`) Using keyword-only arguments (`*`) to reduce the mistakes from `backfilled` being left as a positional argument somewhere and being interpreted wrong by our new arguments.
Closing as this has lived long enough. Still have aspirations to clean up |
Examples:
The interesting spots will be any of the
bool
function parameters, search for: bool.*=?.*,
:outlier
andbackfilled
can be refactored out to options like:inhibit_sync_to_client
inhibit_push_notifications
use_negative_stream_ordering
is_peeking
could be refactored intoinhibit_peekers_viewing_shared_rooms
include_membership
To refactor, it's probably easiest to dive down to the innermost function to find the actual functionality each function parameter triggers and pipe the new options to the top.
In many cases, we rely on
event.internal_metadata
withoutlier
(oris_outlier
),historical
(oris_historical
),soft_failed
(oris_soft_failed
), etc. There are many side-effects from setting something as anoutlier
for example. We could write methods likeevent.internal_metadata.should_proactively_send()
with these descriptive behaviors based on those properties, new ex.event.internal_metadata.should_inhibit_sync_to_client()
.Definition of done
backfilled
function parameters we pipe everywhere with specific behavior optionsbackfilled
into specific behavior function arguments (_persist_events_and_state_updates
) #11417outlier
with specific behavior optionshistorical
with specific behavior options (there will be some overlap withoutlier
andbackfilled
is_peeking
with specific behavior optionsKeywords:
The text was updated successfully, but these errors were encountered: