Skip to content

Commit

Permalink
[OTA-R] Use delayedActionTime to delay QueryImage when supplied (#18832)
Browse files Browse the repository at this point in the history
* Fix for Issue #18432.

* Remove debug code.
  • Loading branch information
isiu-apple authored and pull[bot] committed Sep 1, 2023
1 parent 90eb3d2 commit 1425920
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions src/app/clusters/ota-requestor/DefaultOTARequestorDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -186,17 +186,17 @@ CHIP_ERROR DefaultOTARequestorDriver::UpdateNotFound(UpdateNotFoundReason reason
case UpdateNotFoundReason::kUpToDate:
break;
case UpdateNotFoundReason::kBusy: {
status = ScheduleQueryRetry(true);
status = ScheduleQueryRetry(true, chip::max(kDefaultDelayedActionTime, delay));
if (status == CHIP_ERROR_MAX_RETRY_EXCEEDED)
{
// If max retry exceeded with current provider, try a different provider
status = ScheduleQueryRetry(false);
status = ScheduleQueryRetry(false, chip::max(kDefaultDelayedActionTime, delay));
}
break;
}
case UpdateNotFoundReason::kNotAvailable: {
// Schedule a query only if a different provider is available
status = ScheduleQueryRetry(false);
status = ScheduleQueryRetry(false, chip::max(kDefaultDelayedActionTime, delay));
break;
}
}
Expand Down Expand Up @@ -449,7 +449,7 @@ bool DefaultOTARequestorDriver::GetNextProviderLocation(ProviderLocationType & p
return false;
}

CHIP_ERROR DefaultOTARequestorDriver::ScheduleQueryRetry(bool trySameProvider)
CHIP_ERROR DefaultOTARequestorDriver::ScheduleQueryRetry(bool trySameProvider, System::Clock::Seconds32 delay)
{
CHIP_ERROR status = CHIP_NO_ERROR;

Expand Down Expand Up @@ -483,7 +483,7 @@ CHIP_ERROR DefaultOTARequestorDriver::ScheduleQueryRetry(bool trySameProvider)
if (status == CHIP_NO_ERROR)
{
ChipLogProgress(SoftwareUpdate, "Scheduling a retry");
ScheduleDelayedAction(kDefaultDelayedActionTime, StartDelayTimerHandler, this);
ScheduleDelayedAction(delay, StartDelayTimerHandler, this);
}

return status;
Expand Down
2 changes: 1 addition & 1 deletion src/app/clusters/ota-requestor/DefaultOTARequestorDriver.h
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ class DefaultOTARequestorDriver : public OTARequestorDriver
void CancelDelayedAction(System::TimerCompleteCallback action, void * aAppState);
bool ProviderLocationsEqual(const ProviderLocationType & a, const ProviderLocationType & b);
// Return value of CHIP_NO_ERROR indicates a query retry has been successfully scheduled.
CHIP_ERROR ScheduleQueryRetry(bool trySameProvider);
CHIP_ERROR ScheduleQueryRetry(bool trySameProvider, System::Clock::Seconds32 delay);

OTARequestorInterface * mRequestor = nullptr;
OTAImageProcessorInterface * mImageProcessor = nullptr;
Expand Down

0 comments on commit 1425920

Please sign in to comment.