Skip to content

Commit 94d740f

Browse files
committed
Merge branch 'signals' of https://github.com/NiveditJain/exospherehost into signals
2 parents 87870b0 + b6127ff commit 94d740f

3 files changed

Lines changed: 4 additions & 4 deletions

File tree

state-manager/app/controller/prune_signal.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ async def prune_signal(namespace_name: str, state_id: PydanticObjectId, body: Pr
1313
try:
1414
logger.info(f"Received prune signal for state {state_id} for namespace {namespace_name}", x_exosphere_request_id=x_exosphere_request_id)
1515

16-
state = await State.find_one(State.id == state_id)
16+
state = await State.find_one(State.id == state_id, State.namespace_name == namespace_name)
1717

1818
if not state:
1919
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="State not found")

state-manager/app/controller/re_queue_after_signal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,13 @@ async def re_queue_after_signal(namespace_name: str, state_id: PydanticObjectId,
1313
try:
1414
logger.info(f"Received re-queue after signal for state {state_id} for namespace {namespace_name}", x_exosphere_request_id=x_exosphere_request_id)
1515

16-
state = await State.find_one(State.id == state_id)
16+
state = await State.find_one(State.id == state_id, State.namespace_name == namespace_name)
1717

1818
if not state:
1919
raise HTTPException(status_code=status.HTTP_404_NOT_FOUND, detail="State not found")
2020

2121
state.status = StateStatusEnum.CREATED
22-
state.enqueue_after = state.enqueue_after + body.enqueue_after
22+
state.enqueue_after = int(time.time() * 1000) + body.enqueue_after
2323
await state.save()
2424

2525
return SignalResponseModel(status=StateStatusEnum.CREATED, enqueue_after=state.enqueue_after)

state-manager/app/models/signal_models.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,4 +11,4 @@ class PruneRequestModel(BaseModel):
1111
data: dict[str, Any] = Field(..., description="Data of the state")
1212

1313
class ReEnqueueAfterRequestModel(BaseModel):
14-
enqueue_after: int = Field(..., description="Unix time in milliseconds after which the state should be re-enqueued")
14+
enqueue_after: int = Field(..., description="Duration in milliseconds to delay the re-enqueuing of the state")

0 commit comments

Comments
 (0)