omtimization - remove useless login call (#2036)
This commit is contained in:
parent
812b87ab48
commit
f280505eaa
|
@ -198,18 +198,20 @@ func NewAPIC(config *csconfig.OnlineApiClientCfg, dbClient *database.Client, con
|
||||||
return nil, errors.Wrap(err, "while creating api client")
|
return nil, errors.Wrap(err, "while creating api client")
|
||||||
}
|
}
|
||||||
|
|
||||||
scenarios, err := ret.FetchScenariosListFromDB()
|
// The watcher will be authenticated by the RoundTripper the first time it will call CAPI
|
||||||
if err != nil {
|
// Explicit authentication will provoke an useless supplementary call to CAPI
|
||||||
return ret, errors.Wrapf(err, "get scenario in db: %s", err)
|
// scenarios, err := ret.FetchScenariosListFromDB()
|
||||||
}
|
// if err != nil {
|
||||||
|
// return ret, errors.Wrapf(err, "get scenario in db: %s", err)
|
||||||
|
// }
|
||||||
|
|
||||||
if _, err = ret.apiClient.Auth.AuthenticateWatcher(context.Background(), models.WatcherAuthRequest{
|
// if _, err = ret.apiClient.Auth.AuthenticateWatcher(context.Background(), models.WatcherAuthRequest{
|
||||||
MachineID: &config.Credentials.Login,
|
// MachineID: &config.Credentials.Login,
|
||||||
Password: &password,
|
// Password: &password,
|
||||||
Scenarios: scenarios,
|
// Scenarios: scenarios,
|
||||||
}); err != nil {
|
// }); err != nil {
|
||||||
return ret, errors.Wrapf(err, "authenticate watcher (%s)", config.Credentials.Login)
|
// return ret, errors.Wrapf(err, "authenticate watcher (%s)", config.Credentials.Login)
|
||||||
}
|
// }
|
||||||
|
|
||||||
return ret, err
|
return ret, err
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue