Skip to content

Commit e3862be

Browse files
committed
always flush buffer when the worker process is exiting
1 parent 29ff40b commit e3862be

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

lib/resty/logger/socket.lua

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -328,8 +328,12 @@ local function _flush()
328328
return bytes
329329
end
330330

331-
local function _periodic_flush()
332-
if need_periodic_flush then
331+
local function _periodic_flush(premature)
332+
if premature then
333+
exiting = true
334+
end
335+
336+
if need_periodic_flush or exiting then
333337
-- no regular flush happened after periodic flush timer had been set
334338
if debug then
335339
ngx_log(DEBUG, "performing periodic flush")

0 commit comments

Comments
 (0)