-
-
Notifications
You must be signed in to change notification settings - Fork 95
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
Improve filtering by using per event bitmasks #903
Merged
FasterSpeeding
merged 2 commits into
hikari-py:feature/events-filtering
from
davfsa:task/events-filtering-v2
Mar 25, 2022
Merged
Improve filtering by using per event bitmasks #903
FasterSpeeding
merged 2 commits into
hikari-py:feature/events-filtering
from
davfsa:task/events-filtering-v2
Mar 25, 2022
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
davfsa
commented
Nov 15, 2021
davfsa
force-pushed
the
feature/events-filtering
branch
from
February 2, 2022 17:42
4eaba59
to
6cf3390
Compare
davfsa
force-pushed
the
task/events-filtering-v2
branch
2 times, most recently
from
February 2, 2022 23:06
6ff5020
to
6debf5f
Compare
Ready for another review Flake8 failing is intentional btw |
davfsa
force-pushed
the
task/events-filtering-v2
branch
from
February 2, 2022 23:13
6debf5f
to
0564f6d
Compare
davfsa
force-pushed
the
task/events-filtering-v2
branch
from
February 3, 2022 17:01
0564f6d
to
6b4489f
Compare
davfsa
force-pushed
the
feature/events-filtering
branch
from
February 5, 2022 08:58
6cf3390
to
c91414e
Compare
davfsa
force-pushed
the
task/events-filtering-v2
branch
from
February 5, 2022 09:00
6b4489f
to
ab7358b
Compare
davfsa
force-pushed
the
feature/events-filtering
branch
3 times, most recently
from
March 1, 2022 18:56
c91414e
to
fa1b5b0
Compare
davfsa
force-pushed
the
task/events-filtering-v2
branch
3 times, most recently
from
March 1, 2022 19:20
0233162
to
a19ee66
Compare
* Switch to iterating over mro during listener/waiter registration (rather than during event dispatch) * Add in a system to avoid unmarshalling data for events which aren't being used * Add settings property to cache interface to allow for introspection * Also add "ME" resource to cache config * Specialise guild create and update handlers to avoid unmarshalling data which isn't being cached when no listeners are registered for the event * For this to work gateway guild definition handling had to be refactored to switch to explicitly specifying which mappings it should include when calling it * Logic fixes around event checks * Register listeners by subclasses not parents (mro) (For this the subclasses need to be cached on the Event classes) * Add voodoo on new event cls callback to Event class * This is meant to be a mock way to handle the edge case of new subclassing Event types being added after the event manage has been initialised which might be unorthodox but probably has some wack use case * Switch over to mro based approach * Switch over to mro based approach * Cache whether a consumer can be dispatched or not * Slight logic cleanup * Prefer internal granularity on guild create and update methods * rename event_manager_base.as_listener to "filtered" and remove from on_guild_create and update * Also clear the dispatches for cache when waiters are depleted * Only deserialize guild object on guild create and update if necessary * Add check to shard payload dispatch and refactor consumer check logic * Internal refactors and naming scheme changes * Plus fix CacheImpl.update_me not copying the stored member entry before returning it * Add internal _FilteredMethod proto to event manager base * Move filtering to _handle_dispatch * Add internal _FilteredMethod proto to event manager base * Move filtering to _handle_dispatch * Add trace logging calls to on_guild_create and on_guild_update * Small logic fix + add code/logic comments and docs * As an artifact of this addition, on_guild_integrations_update acn raise NotImplementedError now since it should always be skipped * Some test fixes * cache_components shouldn't ever be undefined if event_types isn't * Try the builder pattern for GatewayGuildDefinition * Switch GatewayGuildDefinition to using getter style methods for delaying deserialization * test fixes and additions * bug fixes + tests * Post-rebase fixes * Have EventManagerBase take components rather than the cache settings * remove _dispatches_for_cache + add in missing filtered decorator calls * Post-rebase fix * post-rebase fixes * Change i forgot to commit * formatting fixes * Mypy and flake8 fixes
davfsa
force-pushed
the
feature/events-filtering
branch
from
March 13, 2022 19:59
fa1b5b0
to
176379c
Compare
davfsa
force-pushed
the
task/events-filtering-v2
branch
2 times, most recently
from
March 13, 2022 20:40
1650549
to
f1e41bd
Compare
davfsa
commented
Mar 21, 2022
davfsa
force-pushed
the
task/events-filtering-v2
branch
2 times, most recently
from
March 22, 2022 09:03
0e5836a
to
f615a54
Compare
davfsa
force-pushed
the
task/events-filtering-v2
branch
from
March 22, 2022 09:09
f615a54
to
69c29f7
Compare
There are some new events missing the filter:
|
FasterSpeeding
approved these changes
Mar 25, 2022
FasterSpeeding
added a commit
that referenced
this pull request
Mar 25, 2022
* Start filtering events before unmarshalling (#636) * Switch to iterating over mro during listener/waiter registration (rather than during event dispatch) * Add in a system to avoid unmarshalling data for events which aren't being used * Add settings property to cache interface to allow for introspection * Also add "ME" resource to cache config * Specialise guild create and update handlers to avoid unmarshalling data which isn't being cached when no listeners are registered for the event * For this to work gateway guild definition handling had to be refactored to switch to explicitly specifying which mappings it should include when calling it * Logic fixes around event checks * Register listeners by subclasses not parents (mro) (For this the subclasses need to be cached on the Event classes) * Add voodoo on new event cls callback to Event class * This is meant to be a mock way to handle the edge case of new subclassing Event types being added after the event manage has been initialised which might be unorthodox but probably has some wack use case * Switch over to mro based approach * Switch over to mro based approach * Cache whether a consumer can be dispatched or not * Slight logic cleanup * Prefer internal granularity on guild create and update methods * rename event_manager_base.as_listener to "filtered" and remove from on_guild_create and update * Also clear the dispatches for cache when waiters are depleted * Only deserialize guild object on guild create and update if necessary * Add check to shard payload dispatch and refactor consumer check logic * Internal refactors and naming scheme changes * Plus fix CacheImpl.update_me not copying the stored member entry before returning it * Add internal _FilteredMethod proto to event manager base * Move filtering to _handle_dispatch * Add internal _FilteredMethod proto to event manager base * Move filtering to _handle_dispatch * Add trace logging calls to on_guild_create and on_guild_update * Small logic fix + add code/logic comments and docs * As an artifact of this addition, on_guild_integrations_update acn raise NotImplementedError now since it should always be skipped * Some test fixes * cache_components shouldn't ever be undefined if event_types isn't * Try the builder pattern for GatewayGuildDefinition * Switch GatewayGuildDefinition to using getter style methods for delaying deserialization * test fixes and additions * bug fixes + tests * Post-rebase fixes * Have EventManagerBase take components rather than the cache settings * remove _dispatches_for_cache + add in missing filtered decorator calls * Post-rebase fix * post-rebase fixes * Change i forgot to commit * formatting fixes * Mypy and flake8 fixes * Improve filtering by using per event bitmasks Co-authored-by: Lucina <luke@lmbyrne.dev>
FasterSpeeding
added a commit
that referenced
this pull request
Mar 25, 2022
* Start filtering events before unmarshalling (#636) * Switch to iterating over mro during listener/waiter registration (rather than during event dispatch) * Add in a system to avoid unmarshalling data for events which aren't being used * Add settings property to cache interface to allow for introspection * Also add "ME" resource to cache config * Specialise guild create and update handlers to avoid unmarshalling data which isn't being cached when no listeners are registered for the event * For this to work gateway guild definition handling had to be refactored to switch to explicitly specifying which mappings it should include when calling it * Logic fixes around event checks * Register listeners by subclasses not parents (mro) (For this the subclasses need to be cached on the Event classes) * Add voodoo on new event cls callback to Event class * This is meant to be a mock way to handle the edge case of new subclassing Event types being added after the event manage has been initialised which might be unorthodox but probably has some wack use case * Switch over to mro based approach * Switch over to mro based approach * Cache whether a consumer can be dispatched or not * Slight logic cleanup * Prefer internal granularity on guild create and update methods * rename event_manager_base.as_listener to "filtered" and remove from on_guild_create and update * Also clear the dispatches for cache when waiters are depleted * Only deserialize guild object on guild create and update if necessary * Add check to shard payload dispatch and refactor consumer check logic * Internal refactors and naming scheme changes * Plus fix CacheImpl.update_me not copying the stored member entry before returning it * Add internal _FilteredMethod proto to event manager base * Move filtering to _handle_dispatch * Add internal _FilteredMethod proto to event manager base * Move filtering to _handle_dispatch * Add trace logging calls to on_guild_create and on_guild_update * Small logic fix + add code/logic comments and docs * As an artifact of this addition, on_guild_integrations_update acn raise NotImplementedError now since it should always be skipped * Some test fixes * cache_components shouldn't ever be undefined if event_types isn't * Try the builder pattern for GatewayGuildDefinition * Switch GatewayGuildDefinition to using getter style methods for delaying deserialization * test fixes and additions * bug fixes + tests * Post-rebase fixes * Have EventManagerBase take components rather than the cache settings * remove _dispatches_for_cache + add in missing filtered decorator calls * Post-rebase fix * post-rebase fixes * Change i forgot to commit * formatting fixes * Mypy and flake8 fixes * Improve filtering by using per event bitmasks Co-authored-by: Lucina <luke@lmbyrne.dev>
FasterSpeeding
added a commit
that referenced
this pull request
Mar 25, 2022
* Start filtering events before unmarshalling (#636) * Switch to iterating over mro during listener/waiter registration (rather than during event dispatch) * Add in a system to avoid unmarshalling data for events which aren't being used * Add settings property to cache interface to allow for introspection * Also add "ME" resource to cache config * Specialise guild create and update handlers to avoid unmarshalling data which isn't being cached when no listeners are registered for the event * For this to work gateway guild definition handling had to be refactored to switch to explicitly specifying which mappings it should include when calling it * Logic fixes around event checks * Register listeners by subclasses not parents (mro) (For this the subclasses need to be cached on the Event classes) * Add voodoo on new event cls callback to Event class * This is meant to be a mock way to handle the edge case of new subclassing Event types being added after the event manage has been initialised which might be unorthodox but probably has some wack use case * Switch over to mro based approach * Switch over to mro based approach * Cache whether a consumer can be dispatched or not * Slight logic cleanup * Prefer internal granularity on guild create and update methods * rename event_manager_base.as_listener to "filtered" and remove from on_guild_create and update * Also clear the dispatches for cache when waiters are depleted * Only deserialize guild object on guild create and update if necessary * Add check to shard payload dispatch and refactor consumer check logic * Internal refactors and naming scheme changes * Plus fix CacheImpl.update_me not copying the stored member entry before returning it * Add internal _FilteredMethod proto to event manager base * Move filtering to _handle_dispatch * Add internal _FilteredMethod proto to event manager base * Move filtering to _handle_dispatch * Add trace logging calls to on_guild_create and on_guild_update * Small logic fix + add code/logic comments and docs * As an artifact of this addition, on_guild_integrations_update acn raise NotImplementedError now since it should always be skipped * Some test fixes * cache_components shouldn't ever be undefined if event_types isn't * Try the builder pattern for GatewayGuildDefinition * Switch GatewayGuildDefinition to using getter style methods for delaying deserialization * test fixes and additions * bug fixes + tests * Post-rebase fixes * Have EventManagerBase take components rather than the cache settings * remove _dispatches_for_cache + add in missing filtered decorator calls * Post-rebase fix * post-rebase fixes * Change i forgot to commit * formatting fixes * Mypy and flake8 fixes * Improve filtering by using per event bitmasks Co-authored-by: Lucina <luke@lmbyrne.dev>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Checklist
nox
and all the pipelines have passed.Related issues
Continuation of #636