More logging

This commit is contained in:
Thomas Sileo 2018-07-14 13:45:06 +02:00
parent a9379a5205
commit 364c1d9273

View file

@ -170,6 +170,7 @@ class MicroblogPubBackend(Backend):
return data["activity"] return data["activity"]
# Fetch the URL via HTTP # Fetch the URL via HTTP
logger.info(f"dereference {iri} via HTTP")
return super().fetch_iri(iri) return super().fetch_iri(iri)
def fetch_iri(self, iri: str) -> ap.ObjectType: def fetch_iri(self, iri: str) -> ap.ObjectType:
@ -177,14 +178,17 @@ class MicroblogPubBackend(Backend):
return ME return ME
if iri in ACTORS_CACHE: if iri in ACTORS_CACHE:
logger.info(f"{iri} found in cache")
return ACTORS_CACHE[iri] return ACTORS_CACHE[iri]
data = DB.actors.find_one({"remote_id": iri}) data = DB.actors.find_one({"remote_id": iri})
if data: if data:
logger.info(f"{iri} found in DB cache")
ACTORS_CACHE[iri] = data["data"] ACTORS_CACHE[iri] = data["data"]
return data["data"] return data["data"]
data = self._fetch_iri(iri) data = self._fetch_iri(iri)
logger.debug(f"_fetch_iri({iri!r}) == {data!r}")
if ap._has_type(data["type"], ap.ACTOR_TYPES): if ap._has_type(data["type"], ap.ACTOR_TYPES):
# Cache the actor # Cache the actor
DB.actors.update_one( DB.actors.update_one(