Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@freelists.org
Cc: kostja@tarantool.org
Subject: [tarantool-patches] [PATCH 1/2] netbox: forbid conn:timeout():execute(...)
Date: Thu,  5 Apr 2018 22:28:09 +0300	[thread overview]
Message-ID: <3874ab58004bb3a499c28eb4880d6828586a3b0b.1522956408.git.v.shpilevoy@tarantool.org> (raw)
In-Reply-To: <cover.1522956408.git.v.shpilevoy@tarantool.org>
In-Reply-To: <cover.1522956408.git.v.shpilevoy@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)

  reply	other threads:[~2018-04-05 19:28 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-05 19:28 [tarantool-patches] [PATCH 0/2] netbox: reuse _request() to do SQL execute() Vladislav Shpilevoy
2018-04-05 19:28 ` Vladislav Shpilevoy [this message]
2018-04-05 20:08   ` [tarantool-patches] Re: [PATCH 1/2] netbox: forbid conn:timeout():execute(...) Konstantin Osipov
2018-04-05 19:28 ` [tarantool-patches] [PATCH 2/2] netbox: reuse _request() to do SQL execute() Vladislav Shpilevoy
2018-04-05 20:07   ` [tarantool-patches] " Konstantin Osipov
2018-04-05 23:30     ` Vladislav Shpilevoy

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3874ab58004bb3a499c28eb4880d6828586a3b0b.1522956408.git.v.shpilevoy@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=kostja@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='Re: [tarantool-patches] [PATCH 1/2] netbox: forbid conn:timeout():execute(...)' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox