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

Switched to AsyncKeyedLock #3066

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

MarkCiliaVincenti
Copy link

This helps clean up from the dictionary and reduces memory allocations. However I'm not sure if urlcacheSem should be static. It feels like it should, but the existing code keeps the dictionaries separate.

{
lock (urlcachelock)
lock (urlcacheSem)
if (urlcache.ContainsKey(url.AbsoluteUri))
Copy link
Contributor

Choose a reason for hiding this comment

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

is this guaranteed to contain the key now? given the above using.

i understand that your the author of the library?

the intent of this function was to dedup http requests/cache and respond

Copy link
Author

Choose a reason for hiding this comment

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

I'm not sure I follow what you mean in your first sentence.

Yes, I am the author of the AsyncKeyedLock library.

Copy link
Contributor

Choose a reason for hiding this comment

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

line
using (urlcacheSem.Lock(url.AbsoluteUri))

must create a state
that
if (urlcache.ContainsKey(url.AbsoluteUri))

will not fail on? ie is it redundant?

Copy link
Author

Choose a reason for hiding this comment

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

No I don't think so. Imagine you fire up the application, urlcache and urlcacheSem will both be empty. If you make a new call to a URL, urlcacheSem will be used, obtains the lock and goes check urlcache to see if it's in the cache. It won't find it.

@MarkCiliaVincenti
Copy link
Author

Is there anything else you need @meee1 ?

@MarkCiliaVincenti
Copy link
Author

@meee1 are you interested or shall I close this PR?

@MarkCiliaVincenti
Copy link
Author

@meee1

@MarkCiliaVincenti
Copy link
Author

@meee1 please let me know

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