-
Notifications
You must be signed in to change notification settings - Fork 203
Fix empty response #559
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
Fix empty response #559
Conversation
- Fixed Benchmark project
…into fix/EmptyResponse
Use editorconfig from roslyn team
Tigraine
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you think this is the best way forward @twenzel then I'm fine with it .. But I feel like this might cause more issues than it solves and there might be a cleaner way to fix this..
| void ResetImports(); | ||
|
|
||
| /// <summary> | ||
| /// Gets the all already imported files |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
probably a typo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
src/dotless.AspNet/HandlerImpl.cs
Outdated
| var source = FileReader.GetFileContents(localPath); | ||
|
|
||
| // Due to the Importer is a singleton, we should always reset the already imported files (#555) | ||
| Engine.ResetImports(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm... I wonder if we could do better because this looks like it might cause issues - esp. with multiple threads calling this
Any way we can get rid of the singleton? Would be way better IMO..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm glad Daniel is awake, since I clearly wasn't. Yes, this will be an issue with multiple threads. In fact, the entire current implementation of Importer is non-threadsafe.
@Tigraine, do you know of a reason why Parser and Importer couldn't be registered as transients in the container? Because I'm thinking that would be the best way to get around this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No I honestly don't know why this was done that way. I suspect it has something to do with the Importer not being able to be passed through the chain to the nodes so it's easier to use a singleton?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I removed this all and registered the parser and importer as transient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
| return duration.Milliseconds; | ||
| }) | ||
| { | ||
| engine.ResetImports(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also this leads to these cases where you have to remember to call ResetImports()
Get benchmark project working again
…into fix/EmptyResponse
Resets the already imported files on the importer, cause this is a singleton instance.
Will fix #555