Tag update over mongo ID

PEP8 changes and Updating tags over Mongo ID
This commit is contained in:
Marvin Martinson 2021-06-01 19:29:56 +00:00
parent ae1c5611e5
commit 00355354f1
1 changed files with 6 additions and 6 deletions

View File

@ -21,6 +21,7 @@ app = Sanic("events")
monitor(app).expose_endpoint()
app.config.RESPONSE_TIMEOUT = 999
def cookie_login(func):
@wraps(func)
async def wrapped(request, *args, **kwargs):
@ -38,7 +39,7 @@ def cookie_login(func):
},
}, {
"$set": {
"last_seen": now,
"last_seen": now
}
})
return await func(request, *args, **kwargs)
@ -86,14 +87,13 @@ async def view_event(request):
events_emitted.inc()
if event.get("operationType") == "update" and "tags" in event.get("updateDescription").get("updatedFields"):
await resp.write("event: tag-update\ndata: %s\n\n" % event["fullDocument"].get("common_name"))
await resp.write("event: tag-update\ndata: %s\n\n" % str(event["documentKey"].get("_id")))
events_emitted.inc()
if event.get("operationType") == "update" and "attributes" in event.get("updateDescription").get("updatedFields"):
await resp.write("event: attribute-update\ndata: %s\n\n" % str(event["documentKey"].get("_id")))
events_emitted.inc()
if event.get("ns").get("coll") == "certidude_logs":
from pinecrypt.server.decorators import MyEncoder