Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@twenzel
Copy link
Contributor

@twenzel twenzel commented Jul 27, 2018

Resets the already imported files on the importer, cause this is a singleton instance.

Will fix #555

@twenzel twenzel requested review from Tigraine and rytmis July 27, 2018 23:21
Copy link
Member

@Tigraine Tigraine left a 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
Copy link
Member

Choose a reason for hiding this comment

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

probably a typo?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fixed.

var source = FileReader.GetFileContents(localPath);

// Due to the Importer is a singleton, we should always reset the already imported files (#555)
Engine.ResetImports();
Copy link
Member

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..

Copy link
Contributor

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.

Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Member

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();
Copy link
Member

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()

@twenzel twenzel merged commit df14ddf into master Aug 8, 2018
@twenzel twenzel deleted the fix/EmptyResponse branch August 8, 2018 19:11
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.

Dotless HttpHandler Returns Empty Response

4 participants