def update_user_data(username, data):
'''
Update the document for the given user,
With the dict of updates provided in `data`
'''
log(0, 'Updating db doc for user {}'.format(username))
req_data = bson.BSON.encode({
"key": key,
"database": "feedlark",
"collection": "user",
"data":{
"updates": data,
"selector":{
"username": username
}
}
})
update_response = gearman_client.submit_job('db-update', str(req_data))
result = bson.BSON(update_response.result).decode()
if result['status'] != 'ok':
log(2, 'Error updating db entry for user {}'.format(username))
log(2, result['description'])
return
评论列表
文章目录