(
fuota_deployment_id: Uuid,
mc_group_setup_timeout: bool,
mc_session_timeout: bool,
frag_session_setup_timeout: bool,
frag_status_timeout: bool,
)
| 527 | } |
| 528 | |
| 529 | pub async fn set_device_timeout_error( |
| 530 | fuota_deployment_id: Uuid, |
| 531 | mc_group_setup_timeout: bool, |
| 532 | mc_session_timeout: bool, |
| 533 | frag_session_setup_timeout: bool, |
| 534 | frag_status_timeout: bool, |
| 535 | ) -> Result<()> { |
| 536 | let fuota_deployment_id = fields::Uuid::from(fuota_deployment_id); |
| 537 | |
| 538 | let mut error_msg = String::new(); |
| 539 | if mc_group_setup_timeout { |
| 540 | error_msg = "McGroupSetupReq timeout.".into(); |
| 541 | } |
| 542 | if mc_session_timeout { |
| 543 | error_msg = "McSessionReq timeout".into(); |
| 544 | } |
| 545 | if frag_session_setup_timeout { |
| 546 | error_msg = "FragSessionSetupReq timeout.".into(); |
| 547 | } |
| 548 | if frag_status_timeout { |
| 549 | error_msg = "FragStatusReq timeout.".into(); |
| 550 | } |
| 551 | |
| 552 | let mut q = diesel::update(fuota_deployment_device::table) |
| 553 | .set(fuota_deployment_device::dsl::error_msg.eq(&error_msg)) |
| 554 | .filter(fuota_deployment_device::dsl::fuota_deployment_id.eq(&fuota_deployment_id)) |
| 555 | .filter(fuota_deployment_device::dsl::error_msg.eq("")) |
| 556 | .into_boxed(); |
| 557 | |
| 558 | if mc_group_setup_timeout { |
| 559 | q = q.filter(fuota_deployment_device::dsl::mc_group_setup_completed_at.is_null()); |
| 560 | } |
| 561 | |
| 562 | if mc_session_timeout { |
| 563 | q = q.filter(fuota_deployment_device::dsl::mc_session_completed_at.is_null()); |
| 564 | } |
| 565 | |
| 566 | if frag_session_setup_timeout { |
| 567 | q = q.filter(fuota_deployment_device::dsl::frag_session_setup_completed_at.is_null()); |
| 568 | } |
| 569 | |
| 570 | if frag_status_timeout { |
| 571 | q = q.filter(fuota_deployment_device::dsl::frag_status_completed_at.is_null()); |
| 572 | } |
| 573 | |
| 574 | q.execute(&mut get_async_db_conn().await?).await?; |
| 575 | |
| 576 | Ok(()) |
| 577 | } |
| 578 | |
| 579 | pub async fn set_device_completed( |
| 580 | fuota_deployment_id: Uuid, |
no test coverage detected