Skip to content

Commit

Permalink
UIA register - fix amount step
Browse files Browse the repository at this point in the history
  • Loading branch information
1aerostorm committed Jan 5, 2024
1 parent dc2048e commit de3c172
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 2 additions & 2 deletions db/reg_pollers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/pages/api/reg/[...all].js
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down

0 comments on commit de3c172

Please sign in to comment.