diff --git a/backend/src/interfaces/agent.py b/backend/src/interfaces/agent.py index 468c240..e2d257e 100644 --- a/backend/src/interfaces/agent.py +++ b/backend/src/interfaces/agent.py @@ -31,6 +31,7 @@ class Agent(BaseModel): subscription_id: str vm_hash: str | None encrypted_secret: str + last_update: int tags: list[str] diff --git a/backend/src/main.py b/backend/src/main.py index a2a95d4..40fb50f 100644 --- a/backend/src/main.py +++ b/backend/src/main.py @@ -1,3 +1,4 @@ +import time from http import HTTPStatus from uuid import uuid4 @@ -48,6 +49,7 @@ async def setup(body: SetupAgentBody) -> None: subscription_id=body.subscription_id, vm_hash=None, encrypted_secret=encrypted_secret, + last_update=int(time.time()), tags=[agent_id, body.subscription_id, body.account.address], ) @@ -127,7 +129,9 @@ async def update(body: UpdateAgentPutBody, code: UploadFile, packages: UploadFil # Updating the related POST message await client.create_post( post_content=Agent( - **agent.dict(exclude={"vm_hash"}), vm_hash=message.item_hash + **agent.dict(exclude={"vm_hash", "last_update"}), + vm_hash=message.item_hash, + last_update=int(time.time()), ), post_type="amend", ref=agent.post_hash,