Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

OP-16308: OP-16308: Wait and retry if connection fails. Also, css file missing fix #218

Merged
merged 1 commit into from
Jun 22, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions gate-core/gate-core.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ dependencies {
implementation "org.apache.commons:commons-lang3"
implementation group: 'io.jsonwebtoken', name: 'jjwt', version: '0.9.1'
implementation group: 'org.springframework.cloud', name: 'spring-cloud-starter-openfeign', version: '2.2.4.RELEASE'
compile group: 'org.springframework.retry', name: 'spring-retry', version: '1.2.2.RELEASE'
}

sourceSets {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import com.netflix.spinnaker.fiat.model.resources.Role
import com.netflix.spinnaker.fiat.shared.FiatPermissionEvaluator
import com.netflix.spinnaker.fiat.shared.FiatService
import com.netflix.spinnaker.fiat.shared.FiatStatus
import com.netflix.spinnaker.gate.retrofit.UpstreamBadRequest
import com.netflix.spinnaker.gate.security.SpinnakerUser
import com.netflix.spinnaker.gate.services.internal.ExtendedFiatService
import com.netflix.spinnaker.kork.core.RetrySupport
Expand All @@ -42,6 +43,8 @@ import javax.annotation.Nonnull
import java.time.Duration

import static com.netflix.spinnaker.gate.retrofit.UpstreamBadRequest.classifyError
import org.springframework.retry.annotation.Backoff;
import org.springframework.retry.annotation.Retryable;

@Slf4j
@Component
Expand Down Expand Up @@ -90,6 +93,8 @@ class PermissionService {
}
}


@Retryable(value = UpstreamBadRequest.class, maxAttempts = 3, backoff = @Backoff(delay = 4000l))
void loginWithRoles(String userId, Collection<String> roles) {
if (fiatStatus.isEnabled()) {
try {
Expand All @@ -98,6 +103,7 @@ class PermissionService {
permissionEvaluator.invalidatePermission(userId)
})
} catch (RetrofitError e) {
log.error("Exception caught while updating the roles. Will wait and retry: {}" , e)
throw classifyError(e)
}
}
Expand Down

Large diffs are not rendered by default.