cloud: clarify reason for guard statement

Added a comment to explain the rationale behind the guard statement, which prevents potential nil errors during backend initialization and retryLogHook call.

Signed-off-by: Bruno Schaatsbergen <git@bschaatsbergen.com>
pull/35929/head
Bruno Schaatsbergen 1 year ago
parent 09ddfc039f
commit 1e80cd8e10
No known key found for this signature in database

@ -605,6 +605,13 @@ func cliConfigToken(hostname svchost.Hostname, services *disco.Disco) (string, e
// retryLogHook is invoked each time a request is retried allowing the
// backend to log any connection issues to prevent data loss.
func (b *Cloud) retryLogHook(attemptNum int, resp *http.Response) {
// FIXME: This guard statement prevents a potential nil error
// due to the way the backend is initialized and the context from which
// this function is called.
//
// In a future refactor, we should ensure that views are natively supported
// in backends and allow for calling a View directly within the
// backend.Configure method.
if b.CLI != nil {
b.View.RetryLog(attemptNum, resp)
}

Loading…
Cancel
Save