Adding Path Resets

Yeah I was wondering that as well, they do a loop like this on keys without the lock elsewhere, so I assumed it was ok, but might be an oversight there as well.  


On Wednesday, November 5, 2014 at 9:12 AM, addelong wrote:

> In yas3fs/__init__.py:
> > @@ -1101,9 +1101,19 @@ def process_message(self, messages): > self.cache.delete(c[3], 'key') > self.cache.delete(c[3], c[2]) > elif c[1] == 'reset': > - with self.cache.lock: > - self.flush_all_cache() > - self.cache.reset_all() # Completely reset the cache > + if len(c) == 2: # If no path, reset everything. > + with self.cache.lock: > + self.flush_all_cache() > + self.cache.reset_all() # Completely reset the cache > + elif c[2] != None: # If there is a path passed in, reset all the items in the path. > + # If the reset is a specific file, make sure to delete the cache specifically > + # which will allow the parent directory to be deleted even if the file is not in cache. > + self.delete_cache(c[2]);  
> I'm wondering if we need a with self.cache.lock: here - the self.delete_cache(path) shouldn't require it, but could the self.cache.entries.keys() collection be modified while the loop is running without a lock?
>  
> —
> Reply to this email directly or view it on GitHub (https://github.com/ceros/yas3fs/pull/1/files#r19878397).
>  
>  
>  
>  
>