-
Notifications
You must be signed in to change notification settings - Fork 881
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(framework) Check TTL when retrieving TaskRes #3635
Conversation
…ttl-when-storing-taskres
) or ( | ||
node_id is None # Anonymous | ||
and task_ins.task.consumer.anonymous is True | ||
and task_ins.task.consumer.node_id == 0 | ||
and task_ins.task.delivered_at == "" | ||
and task_ins.task.created_at + task_ins.task.ttl > time.time() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's do the same thing as we did in the previous PR here
task_ins = self.task_ins_store.get(reply_to) | ||
if task_ins is None: | ||
log(ERROR, "TaskIns with task_id %s does not exist.", reply_to) | ||
return [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not return []
here. Some of the requested task_ids
might have responses and we should return those back to the caller. In the future, we need to introduce a way to return errors for those IDs that are either not existing or expired.
|
||
if task_ins.task.created_at + task_ins.task.ttl <= time.time(): | ||
log(ERROR, "TaskIns with task_id %s is expired.", reply_to) | ||
return [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
task_ins = dict_to_task_ins(row) | ||
if task_ins.task.created_at + task_ins.task.ttl <= time.time(): | ||
log(ERROR, "TaskIns with task_id %s is expired.", task_ins.task_id) | ||
return [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above
task_id = state.store_task_ins(task_ins=task_ins) | ||
|
||
task_res = create_task_res( | ||
producer_node_id=100, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the consumer_node_id
of the TaskIns is 1
, but the producer_node_id
of the replying TaskRes is 100
?
task_id = state.store_task_ins(task_ins=task_ins) | ||
|
||
task_res = create_task_res( | ||
producer_node_id=100, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same question as above.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
Description
This PR checks if the corresponding
TaskIns
exists and remains valid (not expired) when retrievingTaskRes
.Please merge after #3620