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 time
|
||||||
import datetime
|
import datetime
|
||||||
|
import pymongo
|
||||||
import pyes
|
import pyes
|
||||||
import redis
|
import redis
|
||||||
import celery
|
import celery
|
||||||
|
@ -29,7 +30,8 @@ class MUserSearch(mongo.Document):
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_user(cls, user_id):
|
def get_user(cls, user_id):
|
||||||
try:
|
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:
|
except cls.DoesNotExist:
|
||||||
user_search = cls.objects.create(user_id=user_id)
|
user_search = cls.objects.create(user_id=user_id)
|
||||||
|
|
||||||
|
@ -37,9 +39,9 @@ class MUserSearch(mongo.Document):
|
||||||
|
|
||||||
def touch_search_date(self):
|
def touch_search_date(self):
|
||||||
# Blackout
|
# Blackout
|
||||||
# if not self.subscriptions_indexed and not self.subscriptions_indexing:
|
if not self.subscriptions_indexed and not self.subscriptions_indexing:
|
||||||
# self.schedule_index_subscriptions_for_search()
|
self.schedule_index_subscriptions_for_search()
|
||||||
# self.subscriptions_indexing = True
|
self.subscriptions_indexing = True
|
||||||
|
|
||||||
self.last_search_date = datetime.datetime.now()
|
self.last_search_date = datetime.datetime.now()
|
||||||
self.save()
|
self.save()
|
||||||
|
|
Loading…
Add table
Reference in a new issue