mirror of https://github.com/docker/buildx.git
check history api support once
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
1138789f20
commit
2de333fdd3
|
@ -147,11 +147,13 @@ func GetFactories(instanceRequired bool) []Factory {
|
||||||
|
|
||||||
type DriverHandle struct {
|
type DriverHandle struct {
|
||||||
Driver
|
Driver
|
||||||
client *client.Client
|
client *client.Client
|
||||||
err error
|
err error
|
||||||
once sync.Once
|
once sync.Once
|
||||||
featuresOnce sync.Once
|
featuresOnce sync.Once
|
||||||
features map[Feature]bool
|
features map[Feature]bool
|
||||||
|
historyAPISupportedOnce sync.Once
|
||||||
|
historyAPISupported bool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *DriverHandle) Client(ctx context.Context) (*client.Client, error) {
|
func (d *DriverHandle) Client(ctx context.Context) (*client.Client, error) {
|
||||||
|
@ -169,9 +171,10 @@ func (d *DriverHandle) Features(ctx context.Context) map[Feature]bool {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (d *DriverHandle) HistoryAPISupported(ctx context.Context) bool {
|
func (d *DriverHandle) HistoryAPISupported(ctx context.Context) bool {
|
||||||
client, err := d.Client(ctx)
|
d.historyAPISupportedOnce.Do(func() {
|
||||||
if err != nil {
|
if c, err := d.Client(ctx); err == nil {
|
||||||
return false
|
d.historyAPISupported = historyAPISupported(ctx, c)
|
||||||
}
|
}
|
||||||
return historyAPISupported(ctx, client)
|
})
|
||||||
|
return d.historyAPISupported
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue