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
// This handles the edge case when the device is able to receive actions
192
-
// from the broker but for something goes wrong when pushing action statuses back to the backend
193
-
// In this case the backend will try sending the same action again
194
-
//
195
-
// TODO: Right now we use the action status pushed by device as confirmation that it
196
-
// has received the action. It is not very reliable because as of now the action status pipeline can drop messages.
197
-
// Would it be better if the backend used MQTT Ack of the action message instead?
198
-
log::error!("Backend tried sending the same action again!");
199
-
} else if action.name != "cancel_action"{
200
-
self.bridge_tx.send_action_response(ActionResponse::failure(action.action_id.as_str(),"Downloader is already occupied")).await;
201
-
} else {
202
-
match serde_json::from_str::<Cancellation>(&action.payload)
203
-
.context("Invalid cancel action payload")
204
-
.and_then(|cancellation| {
205
-
if cancellation.action_id == state.current.action.action_id {
206
-
Ok(())
207
-
} else {
208
-
Err(anyhow::Error::msg(format!("Cancel action target ({}) doesn't match active download action id ({})", cancellation.action_id,&state.current.action.action_id)))
// This handles the edge case when the device is able to receive actions
195
+
// from the broker but for something goes wrong when pushing action statuses back to the backend
196
+
// In this case the backend will try sending the same action again
197
+
//
198
+
// TODO: Right now we use the action status pushed by device as confirmation that it
199
+
// has received the action. It is not very reliable because as of now the action status pipeline can drop messages.
200
+
// Would it be better if the backend used MQTT Ack of the action message instead?
201
+
log::error!("Backend tried sending the same action again!");
202
+
} else if action.name != "cancel_action"{
203
+
self.bridge_tx.send_action_response(ActionResponse::failure(action.action_id.as_str(),"Downloader is already occupied")).await;
204
+
} else {
205
+
match serde_json::from_str::<Cancellation>(&action.payload)
206
+
.context("Invalid cancel action payload")
207
+
.and_then(|cancellation| {
208
+
if cancellation.action_id == state.current.action.action_id {
209
+
Ok(())
210
+
} else {
211
+
Err(anyhow::Error::msg(format!("Cancel action target ({}) doesn't match active download action id ({})", cancellation.action_id,&state.current.action.action_id)))
0 commit comments