summaryrefslogtreecommitdiff
path: root/init.lua
diff options
context:
space:
mode:
Diffstat (limited to 'init.lua')
-rw-r--r--init.lua10
1 files changed, 6 insertions, 4 deletions
diff --git a/init.lua b/init.lua
index 5043e60..e552fe5 100644
--- a/init.lua
+++ b/init.lua
@@ -19,8 +19,8 @@ local config = require("warming.config")
local policy_mod = require("warming.policy")
local warm = require("warming.warm")
--- A tick is only bookkeeping (poll a job, compare timestamps), so a coarse
--- period is plenty; it is clamped to [1s, 30s].
+-- A tick only inspects extension-owned terminal state and starts a callback
+-- turn when due; it never polls or advances a native operation.
local TICK_MAX_MS = 30000
local function host()
@@ -126,7 +126,8 @@ local function activate()
tick = function()
local now = uv.now()
if current then
- local result = warm.poll(current)
+ local handle = current
+ local result = warm.poll(handle)
if result then
current = nil
policy:attempted(now)
@@ -173,8 +174,9 @@ local function activate()
timer = nil
end
if current then
+ -- Keep the wrapper references through Lua-state teardown; close is
+ -- nonjoining and the binding manager owns native retirement.
warm.abandon(current)
- current = nil
end
end)