mirror of
https://github.com/yusing/godoxy.git
synced 2026-04-23 08:48:32 +02:00
refactor: add context handling in various functions
- Modified functions to accept context.Context as a parameter for better context management. - Updated Init methods in Proxmox and Config to use the provided context. - Adjusted UpdatePorts and NewProxmoxProvider to utilize the context for operations.
This commit is contained in:
@@ -32,7 +32,7 @@ func (c *Config) Client() *Client {
|
||||
return c.client
|
||||
}
|
||||
|
||||
func (c *Config) Init() gperr.Error {
|
||||
func (c *Config) Init(ctx context.Context) gperr.Error {
|
||||
var tr *http.Transport
|
||||
if c.NoTLSVerify {
|
||||
// user specified
|
||||
@@ -56,7 +56,7 @@ func (c *Config) Init() gperr.Error {
|
||||
}
|
||||
c.client = NewClient(c.URL, opts...)
|
||||
|
||||
ctx, cancel := context.WithTimeout(context.Background(), 3*time.Second)
|
||||
ctx, cancel := context.WithTimeout(ctx, 3*time.Second)
|
||||
defer cancel()
|
||||
|
||||
if err := c.client.UpdateClusterInfo(ctx); err != nil {
|
||||
|
||||
Reference in New Issue
Block a user