Skip to content

Commit efd5272

Browse files
retry for ever in download and upload failed
when retries == 0 and operation failed , after (nb_retries-- ) command, nb_retries value equals to 0xffffffff and retry for ever
1 parent 10c06e6 commit efd5272

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

src/chargepoint/maintenance/MaintenanceManager.cpp

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -586,9 +586,9 @@ void MaintenanceManager::processGetDiagnostics(std::string
586586
if (!success)
587587
{
588588
// Next retry
589-
nb_retries--;
590-
if (nb_retries != 0)
589+
if (nb_retries > 0)
591590
{
591+
nb_retries--;
592592
LOG_WARNING << "GetDiagnostics : upload failed (" << nb_retries << " retrie(s) left - next retry in "
593593
<< retry_interval_s.count() << "s)";
594594
std::this_thread::sleep_for(retry_interval_s);
@@ -635,10 +635,12 @@ void MaintenanceManager::processUpdateFirmware(std::string
635635
ocpp::types::Optional<unsigned int> retry_interval,
636636
ocpp::types::DateTime retrieve_date)
637637
{
638+
639+
LOG_INFO << "UpdateFirmware : Waiting until retrieve date:"<<retrieve_date.timestamp()<<" DateTime::now():"<<DateTime::now();
640+
638641
// Check retrieve date
639642
if (retrieve_date > DateTime::now())
640643
{
641-
LOG_INFO << "UpdateFirmware : Waiting until retrieve date";
642644
std::this_thread::sleep_until(std::chrono::system_clock::from_time_t(retrieve_date.timestamp()));
643645
}
644646

@@ -667,9 +669,10 @@ void MaintenanceManager::processUpdateFirmware(std::string
667669
if (!success)
668670
{
669671
// Next retry
670-
nb_retries--;
671-
if (nb_retries != 0)
672+
673+
if (nb_retries > 0)
672674
{
675+
nb_retries--;
673676
LOG_WARNING << "FirmwareUpdate : download failed (" << nb_retries << " retrie(s) left - next retry in "
674677
<< retry_interval_s.count() << "s)";
675678
std::this_thread::sleep_for(retry_interval_s);
@@ -766,10 +769,10 @@ void MaintenanceManager::processGetLog(ocpp::types::LogEnumType type,
766769
success = m_events_handler.uploadFile(local_log_file, url);
767770
if (!success)
768771
{
769-
// Next retry
770-
nb_retries--;
771-
if (nb_retries != 0)
772+
// Next retry
773+
if (nb_retries > 0)
772774
{
775+
nb_retries--;
773776
LOG_WARNING << "GetLog : upload failed (" << nb_retries << " retrie(s) left - next retry in " << retry_interval_s.count()
774777
<< "s)";
775778
std::this_thread::sleep_for(retry_interval_s);
@@ -854,10 +857,10 @@ void MaintenanceManager::processSignedUpdateFirmware(std::string
854857
success = m_events_handler.downloadFile(location, local_firmware_file);
855858
if (!success)
856859
{
857-
// Next retry
858-
nb_retries--;
859-
if (nb_retries != 0)
860+
// Next retry
861+
if (nb_retries > 0)
860862
{
863+
nb_retries--;
861864
LOG_WARNING << "SignedUpdateFirmware : download failed (" << nb_retries << " retrie(s) left - next retry in "
862865
<< retry_interval_s.count() << "s)";
863866
std::this_thread::sleep_for(retry_interval_s);

0 commit comments

Comments
 (0)