Hello,
The API documentation has this, in part, to say about ngx.flush:
"When ngx.flush(true) is called immediately after
ngx.print or
ngx.say, it causes the latter functions to run in synchronous mode. This can be particularly useful for streaming output."
Can there be error checking code in-between the two, does it only matter that there are no other ngx.* functions called? In other words, are the two constructs below the same in terms of the documentation quoted above (assuming no errors are generated)?
-- option 1
ngx.print(...)
ngx.flush(true)
ok, err = ngx.print(..)
if err ~= nil then
return ok, err
end
ok, err = ngx.fush(true)
if err ~= nil then
return ok, err
end