select for update

This commit is contained in:
j 2019-02-02 14:29:12 +05:30
parent a111aaac46
commit c7e316ab22

View file

@ -474,7 +474,8 @@ def removePeering(data):
if len(data.get('id', '')) not in (16, 43): if len(data.get('id', '')) not in (16, 43):
logger.debug('invalid user id') logger.debug('invalid user id')
return {} return {}
u = models.User.get_or_create(data['id']) u = models.User.get(data['id'], for_udpate=True)
if u:
u.info['message'] = data.get('message', '') u.info['message'] = data.get('message', '')
u.update_peering(False) u.update_peering(False)
state.nodes.peer_queue(u.id, 'peering', 'removePeering') state.nodes.peer_queue(u.id, 'peering', 'removePeering')