Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Note: Use end callback when dealing with file streams #765

Closed
jcrugzz opened this issue Nov 26, 2015 · 1 comment
Closed

Note: Use end callback when dealing with file streams #765

jcrugzz opened this issue Nov 26, 2015 · 1 comment

Comments

@jcrugzz
Copy link
Contributor

jcrugzz commented Nov 26, 2015

Note for you @indexzero when reimplementing the file-transport.

When switching to a new file to write to you can:

  1. create a new stream that would begin getting written to
  2. end the stream and pass it the callback to know when its flushed everything in its buffer to disk.

Random notes:

  • The drain event is called when the amount of data in the buffer reaches the highWaterMark
  • What this means is that logs are not flushed to disk when the drain event is called but it means we can begin writing to it again from a backpressure standpoint (if we ever hit that threshold when writing to a file).
  • The only way we know when logs are flushed to disk is when the the callback passed to end is called or the finish event is called if end was called without passing a callback.
  • The above may not hold true during uncaughtExceptions but i think it will get us pretty close.
@indexzero
Copy link
Member

Closing as a duplicate of #1144 – which is now resolved \o/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants