mirror of
https://github.com/viq/NewsBlur.git
synced 2025-09-18 21:43:31 +00:00
Forcing read pref on user search check.
This commit is contained in:
parent
28d51309ce
commit
74e7bfb2c9
1 changed files with 6 additions and 4 deletions
|
@ -1,5 +1,6 @@
|
|||
import time
|
||||
import datetime
|
||||
import pymongo
|
||||
import pyes
|
||||
import redis
|
||||
import celery
|
||||
|
@ -29,7 +30,8 @@ class MUserSearch(mongo.Document):
|
|||
@classmethod
|
||||
def get_user(cls, user_id):
|
||||
try:
|
||||
user_search = cls.objects.get(user_id=user_id)
|
||||
user_search = cls.objects.read_preference(pymongo.ReadPreference.PRIMARY)\
|
||||
.get(user_id=user_id)
|
||||
except cls.DoesNotExist:
|
||||
user_search = cls.objects.create(user_id=user_id)
|
||||
|
||||
|
@ -37,9 +39,9 @@ class MUserSearch(mongo.Document):
|
|||
|
||||
def touch_search_date(self):
|
||||
# Blackout
|
||||
# if not self.subscriptions_indexed and not self.subscriptions_indexing:
|
||||
# self.schedule_index_subscriptions_for_search()
|
||||
# self.subscriptions_indexing = True
|
||||
if not self.subscriptions_indexed and not self.subscriptions_indexing:
|
||||
self.schedule_index_subscriptions_for_search()
|
||||
self.subscriptions_indexing = True
|
||||
|
||||
self.last_search_date = datetime.datetime.now()
|
||||
self.save()
|
||||
|
|
Loading…
Add table
Reference in a new issue