Skip to content

Commit

Permalink
Merge pull request #140 from ministero-salute/fix/408-status-retry-co…
Browse files Browse the repository at this point in the history
…unter

fix: 408 status retry counter
  • Loading branch information
astagi authored Jan 26, 2022
2 parents 389a23e + 11f181a commit 75be86d
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions DGCAVerifier/Services/CRLSynchronizationManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -160,9 +160,9 @@ class CRLSynchronizationManager {
delegate?.statusDidChange(with: .completed)
}

func handleRetry(){
CRLSynchronizationManager.shared.crlFailCounter -= 1
if CRLSynchronizationManager.shared.crlFailCounter < 0 {
func handleRetry() {
self.crlFailCounter -= 1
if self.crlFailCounter < 0 {
log("failed too many times")
if progress.remainingSize == "0.00" || progress.remainingSize == "" {
delegate?.statusDidChange(with: .statusNetworkError)
Expand All @@ -178,13 +178,14 @@ class CRLSynchronizationManager {
}
}

func handleStatusRetry(responseCode: Int?){
self.crlStatusFailCounter -= 1
func handleStatusRetry(responseCode: Int?) {
if responseCode != 408 {
self.crlStatusFailCounter -= 1
}

if self.crlStatusFailCounter < 0 || !Connectivity.isOnline || responseCode == 408 {
self.delegate?.statusDidChange(with: .statusNetworkError)
}
else {
} else {
self.cleanAndRetry()
}
}
Expand Down

0 comments on commit 75be86d

Please sign in to comment.