[patches] [PATCH vshard 2/4] Yield on reloading an infinite fiber
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Mon Feb 26 13:08:54 MSK 2018
If there is an error in a new fiber function, then with no yields
it enters in an infinite loop and block entire TX thread. Do
yield to be able to reload back to the old function.
Signed-off-by: Vladislav Shpilevoy <v.shpilevoy at tarantool.org>
---
vshard/util.lua | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/vshard/util.lua b/vshard/util.lua
index f2feec1..184aad5 100644
--- a/vshard/util.lua
+++ b/vshard/util.lua
@@ -1,5 +1,6 @@
-- vshard.util
-log = require('log')
+local log = require('log')
+local fiber = require('fiber')
--
-- Extract parts of a tuple.
@@ -39,8 +40,10 @@ local function reloadable_fiber_f(M, func_name, worker_name)
local ok, err = pcall(M[func_name], M.module_version)
if not ok then
log.error('%s has been failed: %s', worker_name, err)
+ fiber.yield()
else
log.info('%s has been reloaded', worker_name)
+ fiber.yield()
end
end
end
--
2.14.3 (Apple Git-98)
More information about the Tarantool-patches
mailing list