File tree Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Expand file tree Collapse file tree 2 files changed +9
-8
lines changed Original file line number Diff line number Diff line change @@ -197,7 +197,7 @@ local function _do_flush()
197
197
return nil , err
198
198
end
199
199
200
- return true
200
+ return bytes
201
201
end
202
202
203
203
local function _need_flush ()
@@ -252,14 +252,15 @@ local function _flush()
252
252
ngx_log (DEBUG , " start flushing" )
253
253
end
254
254
255
+ local bytes
255
256
while retry_send <= max_retry_times do
256
257
if log_buffer_index > 0 then
257
258
_prepare_stream_buffer ()
258
259
end
259
260
260
- ok , err = _do_flush ()
261
+ bytes , err = _do_flush ()
261
262
262
- if ok then
263
+ if bytes then
263
264
break
264
265
end
265
266
@@ -277,7 +278,7 @@ local function _flush()
277
278
278
279
_flush_unlock ()
279
280
280
- if not ok then
281
+ if not bytes then
281
282
local err_msg = " try to send log message to the log server "
282
283
.. " failed after " .. max_retry_times .. " retries: "
283
284
.. err
@@ -288,7 +289,7 @@ local function _flush()
288
289
buffer_size = buffer_size - # send_buffer
289
290
send_buffer = " "
290
291
291
- return true
292
+ return bytes
292
293
end
293
294
294
295
local function _flush_buffer ()
Original file line number Diff line number Diff line change @@ -55,8 +55,8 @@ __DATA__
55
55
ngx.log(ngx.ERR, err)
56
56
end
57
57
58
- logger.flush()
59
- ngx.say("ok" )
58
+ local bytes, err = logger.flush()
59
+ ngx.say(bytes )
60
60
';
61
61
}
62
62
--- request
@@ -69,5 +69,5 @@ GET /t?a=1&b=2
69
69
--- tcp_query: abcefg
70
70
--- tcp_query_len: 6
71
71
--- response_body
72
- ok
72
+ 6
73
73
You can’t perform that action at this time.
0 commit comments