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

File transport: lazy file creation #1507

Conversation

kwiatkk1
Copy link
Contributor

This change tries to address the issue #1494.

@@ -105,6 +108,10 @@ module.exports = class File extends TransportStream {
return true;
}

if (this.lazy) {
this.open();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I worry whether this affects performance because this gets called on every log() call -- we should check and see

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right! The first thing open does when it's called, it's checking if it was already opened, but it's an overhead of extra function call in every log operation. So, I will try to change this to flag check here and measure performance.

@@ -105,6 +108,10 @@ module.exports = class File extends TransportStream {
return true;
}

if (this.lazy) {
this.open();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does this work with e.g. file rotation? Maybe it's fine, but I think it would be good if we could add one more test case that makes sure file rotation still works as expected with lazy: true.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes indeed, current tests of file rotation don't have this covered. I will add some tests.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, the lazy option messes up with rotation and stress tests. I think that it's because they are assuming immediate file creation (assertions are constructed that way), not that the outcome is invalid.

@DABH
Copy link
Contributor

DABH commented Oct 19, 2018

Thank you so much for looking into this! I left a few comments for your consideration.

@kwiatkk1
Copy link
Contributor Author

Thanks for the review! I will work on that.

@DABH
Copy link
Contributor

DABH commented Feb 26, 2019

Closing this for now due to inactivity but please feel free to re-open anytime.

@DABH DABH closed this Feb 26, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants