From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id C32852D69E for ; Thu, 5 Apr 2018 15:28:13 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0y-4QPdvdHMQ for ; Thu, 5 Apr 2018 15:28:13 -0400 (EDT) Received: from smtp54.i.mail.ru (smtp54.i.mail.ru [217.69.128.34]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 10F892D673 for ; Thu, 5 Apr 2018 15:28:12 -0400 (EDT) From: Vladislav Shpilevoy Subject: [tarantool-patches] [PATCH 1/2] netbox: forbid conn:timeout():execute(...) Date: Thu, 5 Apr 2018 22:28:09 +0300 Message-Id: <3874ab58004bb3a499c28eb4880d6828586a3b0b.1522956408.git.v.shpilevoy@tarantool.org> In-Reply-To: References: In-Reply-To: References: Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-help: List-unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-subscribe: List-owner: List-post: List-archive: To: tarantool-patches@freelists.org Cc: kostja@tarantool.org This API is deprecated in 1.7.4, so it must not be supported in new methods like execute(). --- src/box/lua/net_box.lua | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/src/box/lua/net_box.lua b/src/box/lua/net_box.lua index fe65eac72..8d1955315 100644 --- a/src/box/lua/net_box.lua +++ b/src/box/lua/net_box.lua @@ -833,18 +833,6 @@ function remote_methods:wait_connected(timeout) return self._transport.wait_state('active', timeout) end -function remote_methods:request_timeout(request_opts) - local timeout = request_opts and request_opts.timeout - if timeout == nil then - -- conn:timeout(timeout):ping() - -- @deprecated since 1.7.4 - local deadline = self._deadlines[fiber_self()] - timeout = deadline and max(0, deadline - fiber_clock()) - or (request_opts and request_opts.timeout) - end - return timeout -end - function remote_methods:_request(method, opts, ...) local this_fiber = fiber_self() local transport = self._transport @@ -890,7 +878,14 @@ end function remote_methods:ping(opts) check_remote_arg(self, 'ping') - local timeout = self:request_timeout(opts) + local timeout = opts and opts.timeout + if timeout == nil then + -- conn:timeout(timeout):ping() + -- @deprecated since 1.7.4 + local deadline = self._deadlines[fiber_self()] + timeout = deadline and max(0, deadline - fiber_clock()) + or (opts and opts.timeout) + end local err = self._transport.perform_request(timeout, nil, 'ping', self.schema_version) return not err or err == E_WRONG_SCHEMA_VERSION @@ -941,13 +936,14 @@ function remote_methods:execute(query, parameters, sql_opts, netbox_opts) if sql_opts ~= nil then box.error(box.error.UNSUPPORTED, "execute", "options") end - local timeout = self:request_timeout(netbox_opts) + local timeout = netbox_opts and netbox_opts.timeout local buffer = netbox_opts and netbox_opts.buffer parameters = parameters or {} sql_opts = sql_opts or {} - local err, res, metadata, info = self._transport.perform_request(timeout, - buffer, 'execute', self.schema_version, - query, parameters, sql_opts) + local err, res, metadata, info = + self._transport.perform_request(timeout, buffer, 'execute', + self.schema_version, query, parameters, + sql_opts) if err then box.error({code = err, reason = res}) end -- 2.14.3 (Apple Git-98)