mirror of
https://github.com/Snawoot/opera-proxy.git
synced 2025-09-01 18:20:23 +00:00
main: refresh device password by schedule
This commit is contained in:
parent
298c91b4b5
commit
955660d33e
1 changed files with 12 additions and 2 deletions
14
main.go
14
main.go
|
@ -210,14 +210,24 @@ func run() int {
|
|||
|
||||
runTicker(context.Background(), args.refresh, func(ctx context.Context) {
|
||||
mainLogger.Info("Refreshing login...")
|
||||
loginCtx, cl := context.WithTimeout(ctx, args.timeout)
|
||||
reqCtx, cl := context.WithTimeout(ctx, args.timeout)
|
||||
defer cl()
|
||||
err := seclient.Login(loginCtx)
|
||||
err := seclient.Login(reqCtx)
|
||||
if err != nil {
|
||||
mainLogger.Critical("Login refresh failed: %v", err)
|
||||
return
|
||||
}
|
||||
mainLogger.Info("Login refreshed.")
|
||||
|
||||
mainLogger.Info("Refreshing device password...")
|
||||
reqCtx, cl = context.WithTimeout(ctx, args.timeout)
|
||||
defer cl()
|
||||
err = seclient.DeviceGeneratePassword(reqCtx)
|
||||
if err != nil {
|
||||
mainLogger.Critical("Device password refresh failed: %v", err)
|
||||
return
|
||||
}
|
||||
mainLogger.Info("Device password refreshed.")
|
||||
})
|
||||
|
||||
if args.listCountries {
|
||||
|
|
Loading…
Add table
Reference in a new issue