Skip to content

Commit 2459f92

Browse files
authored
feat: Add Warmup function for starting background refresh (#163)
1 parent 998ef49 commit 2459f92

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

dialer.go

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,13 @@ func (d *Dialer) EngineVersion(ctx context.Context, instance string) (string, er
251251
return e, nil
252252
}
253253

254+
// Warmup starts the background refresh neccesary to connect to the instance. Use Warmup
255+
// to start the refresh process early if you don't know when you'll need to call "Dial".
256+
func (d *Dialer) Warmup(ctx context.Context, instance string, opts ...DialOption) error {
257+
_, err := d.instance(instance)
258+
return err
259+
}
260+
254261
// newInstrumentedConn initializes an instrumentedConn that on closing will
255262
// decrement the number of open connects and record the result.
256263
func newInstrumentedConn(conn net.Conn, closeFunc func()) *instrumentedConn {

0 commit comments

Comments
 (0)