Skip to content

Commit 41441ad

Browse files
committed
add LazyConnect for faster startup
Signed-off-by: Markus Blaschke <[email protected]>
1 parent 7cab87d commit 41441ad

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

azuresdk/armclient/client.go

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -135,8 +135,8 @@ func (azureClient *ArmClient) initServiceDiscovery() {
135135
}
136136
}
137137

138-
// Connect triggers and logs connect message
139-
func (azureClient *ArmClient) Connect() error {
138+
// LazyConnect triggers and logs connect message
139+
func (azureClient *ArmClient) LazyConnect() error {
140140
ctx := context.Background()
141141

142142
azureClient.logger.Infof(
@@ -158,6 +158,16 @@ func (azureClient *ArmClient) Connect() error {
158158
} else {
159159
azureClient.logger.Warn(`unable to get Azure client information, cannot parse accesstoken`)
160160
}
161+
}
162+
163+
// Connect triggers and logs connect message
164+
func (azureClient *ArmClient) Connect() error {
165+
ctx := context.Background()
166+
167+
err := azureClient.LazyConnect()
168+
if err != nil {
169+
return err
170+
}
161171

162172
subscriptionList, err := azureClient.ListSubscriptions(ctx)
163173
if err != nil {

0 commit comments

Comments
 (0)