diff --git a/db/reg_pollers.lua b/db/reg_pollers.lua index fc9584d..20287ab 100644 --- a/db/reg_pollers.lua +++ b/db/reg_pollers.lua @@ -42,7 +42,7 @@ local function wrap_rp(rp) } end -function get_free_reg_poller(amount, sym, now) +function get_free_reg_poller(amount, sym, step, now) local rps = nil repeat if rps ~= nil then @@ -51,7 +51,7 @@ function get_free_reg_poller(amount, sym, now) box.space.reg_pollers:delete(rp['id']) break end - amount = amount + 1 + amount = amount + step end rps = box.space.reg_pollers.index.by_amount:select{sym, amount} until #rps == 0 diff --git a/src/pages/api/reg/[...all].js b/src/pages/api/reg/[...all].js index da25ee2..0885063 100644 --- a/src/pages/api/reg/[...all].js +++ b/src/pages/api/reg/[...all].js @@ -324,10 +324,12 @@ let handler = nextConnect({ attachParams: true, }) let freeAmount try { + const amountStep = 1 / Math.pow(10, amount.precision || 1) freeAmount = await Tarantool.instance('tarantool') .call('get_free_reg_poller', parseFloat(amount.amountFloat), amount.symbol, + amountStep, Date.now() ) freeAmount = freeAmount[0][0]