Was incorrectly clearing river stories from the wrong db.

This commit is contained in:
Samuel Clay 2022-11-26 12:14:06 -05:00
parent 8898dc5de5
commit 4297ac2e31
3 changed files with 6 additions and 4 deletions

View file

@ -350,7 +350,10 @@ class UserSubscription(models.Model):
@classmethod
def truncate_river(cls, user_id, feed_ids, read_filter, cache_prefix=""):
rt = redis.Redis(connection_pool=settings.REDIS_STORY_HASH_TEMP_POOL)
if cache_prefix:
rt = redis.Redis(connection_pool=settings.REDIS_STORY_HASH_SECONDARY_POOL)
else:
rt = redis.Redis(connection_pool=settings.REDIS_STORY_HASH_POOL)
feeds_string = ','.join(str(f) for f in sorted(feed_ids))[:30]
ranked_stories_keys = '%szU:%s:feeds:%s' % (cache_prefix, user_id, feeds_string)

View file

@ -1112,7 +1112,7 @@ class MSocialSubscription(mongo.Document):
def feed_stories(cls, user_id, social_user_ids, offset=0, limit=6,
order='newest', read_filter='all', relative_user_id=None, cache=True,
socialsubs=None, cutoff_date=None, dashboard_global=False):
rt = redis.Redis(connection_pool=settings.REDIS_STORY_HASH_TEMP_POOL)
rt = redis.Redis(connection_pool=settings.REDIS_STORY_HASH_POOL)
if not relative_user_id:
relative_user_id = user_id

View file

@ -795,7 +795,6 @@ REDIS_POOL = redis.ConnectionPool(host=REDIS_USER['host'], port=
REDIS_ANALYTICS_POOL = redis.ConnectionPool(host=REDIS_USER['host'], port=REDIS_PORT, db=2, decode_responses=True)
REDIS_STATISTICS_POOL = redis.ConnectionPool(host=REDIS_USER['host'], port=REDIS_PORT, db=3, decode_responses=True)
REDIS_FEED_UPDATE_POOL = redis.ConnectionPool(host=REDIS_USER['host'], port=REDIS_PORT, db=4, decode_responses=True)
REDIS_STORY_HASH_TEMP_POOL = redis.ConnectionPool(host=REDIS_USER['host'], port=REDIS_PORT, db=10, decode_responses=True)
# REDIS_CACHE_POOL = redis.ConnectionPool(host=REDIS_USER['host'], port=REDIS_PORT, db=6) # Duped in CACHES
REDIS_STORY_HASH_POOL = redis.ConnectionPool(host=REDIS_STORY['host'], port=REDIS_PORT, db=1, decode_responses=True)
REDIS_STORY_HASH_SECONDARY_POOL = redis.ConnectionPool(host=REDIS_STORY_SECONDARY['host'], port=REDIS_STORY_SECONDARY['port'], db=1, decode_responses=True)