boxlang-express 0.2.24
Released .
- Scheduler fixes (
models/Scheduler.bx):- A run the stall watchdog gave up on could, when it finally returned, mark the job idle while its replacement was still running, so the next tick started a third run alongside it — the overlap guard was off for as long as that lasted. Each run now owns the job by id and only the current owner can release it.
- A job that cancelled itself during its first
immediate: truerun could beatschedule()to storing the timer's future;cancel()then failed, was logged as a job failure, and the job kept running. Cancellation now works whichever side gets there first. intervalMsis validated: anything but a whole number of milliseconds, 1 or more, throwsBoxExpress.InvalidArgument. Before, the JDK rejected it only after the job was registered, leaving a dead job ingetScheduledJobs()and metrics.- Job ids come from an atomic counter. Two concurrent
schedule()calls could get the same id, and the second overwrote the first, leaving its timer ticking with no way to cancel it. - Two concurrent first calls to
app.schedule()could each create aScheduler, and jobs registered on the one that lost were never reachable bygetScheduledJobs(), metrics orclose(). The lazy creation (andapp.getClusterManager()'s) is now locked. - New
options.stallThresholdMsoverrides the stall threshold. running(ingetScheduledJobs()and theboxexpress_scheduler_job_runningmetric) counts runs actually in flight.
- Cluster manager election (
models/cluster/ClusterManager.bx): the manager claim was only written when no live manager was found and never renewed, so it expired everypeerIdleTimeoutSeconds * 3and went to whichever instance checked next, and two instances checking at once could both claim it and both run a clustered job. Now a live manager keeps the role and renews its claim on each check and heartbeat, and with no live manager every instance picks the same winner — the lowest-named live election candidate — and only it writes the claim. Only instances that have checked (ones with clustered jobs) are candidates. See "How the manager is elected" indocs/cluster.md. - Heartbeat interval is a third of
peerIdleTimeoutSecondswith a 1s minimum, down from a 5s minimum that made any idle timeout under 15s expire live peers between heartbeats.