Remove unneeded retrieval of Service object in remote trigger worker
@@ -21,8 +21,6 @@ def celery_shutdown(**kwargs):
@celery_app.task(acks_late=True)
def trigger_remote(service_id, affected_connection_external_ids_with_payloads):
from tapiriik.auth import User
- from tapiriik.services import Service
- svc = Service.FromID(service_id)
affected_connection_ids = list()
for item in affected_connection_external_ids_with_payloads:
@@ -34,7 +32,7 @@ def trigger_remote(service_id, affected_connection_external_ids_with_payloads):
update_connection_query = {"$set":{"TriggerPartialSync": True, "TriggerPartialSyncTimestamp": datetime.utcnow()}}
if payload is not None:
update_connection_query.update({"$push": {"TriggerPartialSyncPayloads": payload, "$slice": -90}})
- record = db.connections.find_and_modify({"Service": svc.ID, "ExternalID": external_id}, update_connection_query, w=MONGO_FULL_WRITE_CONCERN)
+ record = db.connections.find_and_modify({"Service": service_id, "ExternalID": external_id}, update_connection_query, w=MONGO_FULL_WRITE_CONCERN)
if record is not None:
affected_connection_ids.append(record["_id"])
