That's fine, but, I think unnecessary. Since we still fetch to check the
headers for new modification time we still block on network. The parsing is
CPU bound, which is likely the smallest part of the request overhead.

I still say keep it simple. Skip the cache.
On Mar 20, 2014 4:38 PM, "gergely-ujvari" <notifications@github.com> wrote:

> In h/domain_mailer.py:
>
> > +AnnotationNotifier.register_template('document_owner', DocumentOwnerTemplate.generate_notification)
> > +
> > +document_cache = {}
> > +
> > +
> > +@subscriber(events.AnnotationEvent)
> > +def domain_notification(event):
> > +    if event.action == 'create':
> > +        try:
> > +            annotation = event.annotation
> > +            uri = annotation['uri']
> > +            r = requests.get(uri)
> > +            page_date = r.headers['last-modified'] if 'last-modified' in r.headers else r.headers['date']
> > +
> > +            # Check if the page is not cached or the cache is old
> > +            if uri not in document_cache or document_cache[uri]['date'] != page_date:
>
> I've added functools32 lru cache and got rid of our cache.
>
> --
> Reply to this email directly or view it on GitHub<https://github.com/hypothesis/h/pull/1085/files#r10822311>
> .
>