Software /
code /
prosody
Changeset
8762:2f8523bf7ff2
util.timer: Ensure we don't try to schedule negative timeouts (which rightly upset libevent). Fixes #1135
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sun, 29 Apr 2018 21:43:39 +0100 |
parents | 8761:b6e193e33145 |
children | 8763:67ecff7be011 |
files | util/timer.lua |
diffstat | 1 files changed, 2 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/util/timer.lua Wed Apr 25 11:55:03 2018 +0100 +++ b/util/timer.lua Sun Apr 29 21:43:39 2018 +0100 @@ -15,6 +15,7 @@ local debug_traceback = debug.traceback; local tostring = tostring; local xpcall = xpcall; +local math_max = math.max; local _ENV = nil; -- luacheck: std none @@ -87,7 +88,7 @@ next_time = peek; _server_timer:close(); if next_time ~= nil then - _server_timer = _add_task(next_time - get_time(), _on_timer); + _server_timer = _add_task(math_max(next_time - get_time(), 0), _on_timer); end end return result, item, result_sync;