You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to kindly bring attention to a potential issue in the ChatFunction, which is invoked by the chatRule IoT TopicRule. This function calls the IotData.publish to send chat messages to the frontend, where the frontend appends the new messages with previous ones. However, this message sending is not idempotent. Suppose the IoT-triggered function crashes after successfully sending a chat message to the frontend-facing IoT topic (but before acknowledging the event source that the function has finished). In that case, when the function is retried, another message will be sent and received by the frontend.
Suggested Fix:
Although there's no serious harm in sending two identical chat messages, this duplicate sending due to untimely retries can be prevented. Specifically, one can attach a unique id to each chat message when the message is being generated. Before the frontend appends the new message to the message list, it should check whether the message id is already present in a deduplication set for holding all previous chat message ids. If the id is already present, don't append the message. Otherwise, append the message as usual.
Thank you for considering this feedback. I hope that this suggestion could help improve the idempotency and user experience of the ChatFunction. Please feel free to reach out if you have any questions or concerns.
The text was updated successfully, but these errors were encountered:
Description:
I would like to kindly bring attention to a potential issue in the ChatFunction, which is invoked by the chatRule IoT TopicRule. This function calls the IotData.publish to send chat messages to the frontend, where the frontend appends the new messages with previous ones. However, this message sending is not idempotent. Suppose the IoT-triggered function crashes after successfully sending a chat message to the frontend-facing IoT topic (but before acknowledging the event source that the function has finished). In that case, when the function is retried, another message will be sent and received by the frontend.
Suggested Fix:
Although there's no serious harm in sending two identical chat messages, this duplicate sending due to untimely retries can be prevented. Specifically, one can attach a unique id to each chat message when the message is being generated. Before the frontend appends the new message to the message list, it should check whether the message id is already present in a deduplication set for holding all previous chat message ids. If the id is already present, don't append the message. Otherwise, append the message as usual.
Thank you for considering this feedback. I hope that this suggestion could help improve the idempotency and user experience of the ChatFunction. Please feel free to reach out if you have any questions or concerns.
The text was updated successfully, but these errors were encountered: