Refactor to delete add_object_to_related_stores
This is working towards some optimizations.
This commit is contained in:
parent
9c54030b61
commit
93bd66ad3e
3 changed files with 4 additions and 7 deletions
|
@ -39,7 +39,9 @@ class ActivityStream(RedisStore):
|
|||
def add_status(self, status, increment_unread=False):
|
||||
"""add a status to users' feeds"""
|
||||
# the pipeline contains all the add-to-stream activities
|
||||
pipeline = self.add_object_to_related_stores(status, execute=False)
|
||||
pipeline = self.add_object_to_stores(
|
||||
status, self.get_stores_for_object(status), execute=False
|
||||
)
|
||||
|
||||
if increment_unread:
|
||||
for user_id in self.get_audience(status):
|
||||
|
|
|
@ -24,8 +24,7 @@ class ListsStream(RedisStore):
|
|||
|
||||
def add_list(self, book_list):
|
||||
"""add a list to users' feeds"""
|
||||
# the pipeline contains all the add-to-stream activities
|
||||
self.add_object_to_related_stores(book_list)
|
||||
self.add_object_to_stores(book_list, self.get_stores_for_object(book_list))
|
||||
|
||||
def add_user_lists(self, viewer, user):
|
||||
"""add a user's lists to another user's feed"""
|
||||
|
|
|
@ -32,10 +32,6 @@ class RedisStore(ABC):
|
|||
# and go!
|
||||
return pipeline.execute()
|
||||
|
||||
def add_object_to_related_stores(self, obj, execute=True):
|
||||
"""add an object to all suitable stores"""
|
||||
return self.add_object_to_stores(obj, self.get_stores_for_object(obj), execute)
|
||||
|
||||
def remove_object_from_related_stores(self, obj, stores=None):
|
||||
"""remove an object from all stores"""
|
||||
# if the stoers are provided, the object can just be an id
|
||||
|
|
Loading…
Add table
Reference in a new issue