From 15e6c95042b2409f561af4172b6ed2586cfced97 Mon Sep 17 00:00:00 2001 From: Tom Limoncelli Date: Thu, 21 Jul 2022 14:35:37 -0400 Subject: [PATCH] CSCGLOBAL: Lazy-check API results, saving 5-7 minutes per domain (#1638) --- providers/cscglobal/api.go | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/providers/cscglobal/api.go b/providers/cscglobal/api.go index 29dcc2141..50a7d3ccf 100644 --- a/providers/cscglobal/api.go +++ b/providers/cscglobal/api.go @@ -4,7 +4,6 @@ import ( "bytes" "encoding/json" "fmt" - "github.com/StackExchange/dnscontrol/v3/pkg/printer" "io/ioutil" "net/http" "os" @@ -12,6 +11,8 @@ import ( "strings" "time" + "github.com/StackExchange/dnscontrol/v3/pkg/printer" + "github.com/mattn/go-isatty" ) @@ -377,6 +378,7 @@ func (client *providerClient) sendZoneEditRequest(domainname string, edits []zon return err } + // What did we get back? var errResp zoneEditRequestResultZoneEditRequestResult err = json.Unmarshal(responseBody, &errResp) if err != nil { @@ -386,9 +388,13 @@ func (client *providerClient) sendZoneEditRequest(domainname string, edits []zon return fmt.Errorf("CSC Global API error: %s DATA: %q", errResp.Content.Status, errResp.Content.Message) } - // The request was successfully submitted. Now query the status link until the request is complete. - statusURL := errResp.Links.Status - return client.waitRequestURL(statusURL) + // NB(tlim): The request was successfully submitted. The "statusURL" is what we query if we want to wait until the request was processed and see if it was a success. + // Right now we don't want to wait. Instead, the next time we do a mutation we wait then. + // If we ever change our mind and want to wait for success/failure, it would look like: + //statusURL := errResp.Links.Status + //return client.waitRequestURL(statusURL) + + return nil } func (client *providerClient) waitRequest(reqID string) error {