Skip to content

Commit

Permalink
Dont check status before block (#107)
Browse files Browse the repository at this point in the history
* Dont check status before block
  • Loading branch information
madisonchamberlain committed Nov 23, 2022
1 parent 2b16a0a commit b43df02
Showing 1 changed file with 1 addition and 17 deletions.
18 changes: 1 addition & 17 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import (
"database/sql"
"database/sql/driver"
"encoding/json"
"errors"
"net/http"
"net/url"
"os"
Expand Down Expand Up @@ -555,22 +554,7 @@ func (sc *snowflakeConn) FetchResult(ctx context.Context, qid string) (driver.Ro
// go sql library but is exported to clients who can make use of this
// capability explicitly.
func (sc *snowflakeConn) WaitForQueryCompletion(ctx context.Context, qid string) error {
// if the query is already done, we dont need to wait for it
_, err := sc.checkQueryStatus(ctx, qid)
// query is complete and has succeeded
if err == nil {
return nil
}
// if error = query is still running; wait for it to complete
var snowflakeError *SnowflakeError
if errors.As(err, &snowflakeError) {
if snowflakeError.Number == ErrQueryIsRunning {
return sc.blockOnQueryCompletion(ctx, qid)
}
}

// query is complete because of an error; return that error
return err
return sc.blockOnQueryCompletion(ctx, qid)
}

// ResultFetcher is an interface which allows a query result to be
Expand Down

0 comments on commit b43df02

Please sign in to comment.