def _delete_inactivity_succeed(self, req, timer): res = internal_pb2.DeleteUserRes() res.status = 0 response = res.SerializeToString() logger.notice("Delete inactivity user succeed" "[user_id=%d][req=%s][res=%s][consume=%d]" % (timer.id, req, res, timer.count_ms())) return response
def _delete_failed(self, err, req, timer): logger.fatal("Delete failed[reason=%s]" % err) res = internal_pb2.DeleteUserRes() res.status = -1 response = res.SerializeToString() logger.notice("Delete failed[user_id=%d][req=%s][res=%s][consume=%d]" % (timer.id, req, res, timer.count_ms())) return response
def _delete_user_result(fwd_response, ids, index): fwd_res = internal_pb2.DeleteUserRes() fwd_res.ParseFromString(fwd_response) if fwd_res.status != 0: #return False pass if index >= len(ids): return True defer = _delete_user(ids, index) return defer
def clear_cache(self, user_id, request): """清除用户数据缓存 """ timer = Timer(user_id) req = internal_pb2.DeleteUserReq() req.ParseFromString(request) DataBase().clear_data_by_id(user_id) res = internal_pb2.DeleteUserRes() res.status = 0 response = res.SerializeToString() logger.notice( "Clear cache succeed[id=%d][req=%s][res=%s][consume=%d]" % (timer.id, req, res, timer.count_ms())) return response