Always store users

In case of write failure user profile may become inconsistent,
and there's no way to re-write it by all keys. Remove store optimization
and always store users from default_data by all possible keys.

Change-Id: I23e0c1107b87485d1c86e2e2133ceb77ee954b4e
This commit is contained in:
Ilya Shakhat 2016-06-22 13:38:30 +03:00
parent 7c97cd2873
commit 028f7bcb12
3 changed files with 4 additions and 12 deletions

View File

@ -38,6 +38,9 @@
{%if github_id %}
<div>Github: <a href="https://github.com/${github_id}" target="_blank">${github_id}</a></div>
{%/if%}
{%if zanata_id %}
<div>Zanata: <a href="https://translate.openstack.org/profile/view/${zanata_id}" target="_blank">${zanata_id}</a></div>
{%/if%}
{%if ldap_id %}
<div>LDAP: ${ldap_id}</div>
{%/if%}

View File

@ -46,6 +46,7 @@ def _normalize_user(user):
emails=user.get('emails'),
gerrit_id=user.get('gerrit_id'),
github_id=user.get('github_id'),
zanata_id=user.get('zanata_id'),
ldap_id=user.get('ldap_id')) or user.get('user_id')

View File

@ -41,21 +41,9 @@ def make_user_id(emails=None, launchpad_id=None, gerrit_id=None,
def store_user(runtime_storage_inst, user):
write_flag = False
if not user.get('seq'):
user['seq'] = runtime_storage_inst.inc_user_count()
LOG.debug('New user: %s', user)
write_flag = True
else:
stored_user = runtime_storage_inst.get_by_key(
'user:%d' % user.get('seq'))
if stored_user != user:
LOG.debug('User updated: %s', user)
write_flag = True
if not write_flag:
return
runtime_storage_inst.set_by_key('user:%d' % user['seq'], user)
if user.get('user_id'):