Elastic: search indexing logging tweaks
This commit is contained in:
parent
0b6969bf0c
commit
f6cf8d29f0
@ -41,11 +41,10 @@ class ResetIndexTask(object):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
idx.delete(ignore=404)
|
idx.delete(ignore=404)
|
||||||
log.info("Deleted index %s", index)
|
|
||||||
except NotFoundError:
|
except NotFoundError:
|
||||||
log.warning("Could not delete index '%s', ignoring", index)
|
log.warning("Could not delete index '%s', ignoring", index)
|
||||||
else:
|
else:
|
||||||
log.warning("Could not delete index '%s', ignoring", index)
|
log.info("Deleted index %s", index)
|
||||||
|
|
||||||
# create doc types
|
# create doc types
|
||||||
for dt in self.doc_types:
|
for dt in self.doc_types:
|
||||||
|
@ -126,7 +126,7 @@ def prepare_user_data(user_id: str, user=None) -> dict:
|
|||||||
user = users_coll.find_one({'_id': user_oid})
|
user = users_coll.find_one({'_id': user_oid})
|
||||||
|
|
||||||
if user is None:
|
if user is None:
|
||||||
log.warning('Unable to find user %s, not updating Algolia.', user_id)
|
log.warning('Unable to find user %s, not updating search index.', user_id)
|
||||||
return {}
|
return {}
|
||||||
|
|
||||||
user_roles = set(user.get('roles', ()))
|
user_roles = set(user.get('roles', ()))
|
||||||
|
@ -42,6 +42,9 @@ def reset_index(indices):
|
|||||||
def _reindex_users():
|
def _reindex_users():
|
||||||
db = current_app.db()
|
db = current_app.db()
|
||||||
users_coll = db['users']
|
users_coll = db['users']
|
||||||
|
|
||||||
|
# Note that this also finds service accounts, which are filtered out
|
||||||
|
# in prepare_user_data(…)
|
||||||
users = users_coll.find()
|
users = users_coll.find()
|
||||||
user_count = users.count()
|
user_count = users.count()
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user