Skip to content

Commit d8037dd

Browse files
committed
Merge branch 'v1.12.x' into develop
2 parents a1911d6 + d0c11a7 commit d8037dd

File tree

4 files changed

+18
-28
lines changed

4 files changed

+18
-28
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## v1.12.1 [2024-11-20]
2+
_Bug fixes_
3+
* Fix issue where steampipe interactive metacommand `.cache clear` was not clearing the cache. ([#520](https://github.com/turbot/steampipe-postgres-fdw/issues/520))
4+
15
## v1.12.0 [2024-10-22]
26
_Whats new_
37
* Build FDW for Steampipe v1.0.0. ([#515](https://github.com/turbot/steampipe-postgres-fdw/issues/515))

hub/hub_base.go

+4-21
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,20 @@ package hub
33
import (
44
"context"
55
"fmt"
6-
"log"
7-
"strings"
8-
"sync"
9-
"time"
10-
11-
"github.com/turbot/steampipe/pkg/query/queryresult"
12-
136
"github.com/turbot/go-kit/helpers"
147
"github.com/turbot/steampipe-plugin-sdk/v5/grpc"
158
"github.com/turbot/steampipe-plugin-sdk/v5/grpc/proto"
169
"github.com/turbot/steampipe-plugin-sdk/v5/telemetry"
1710
"github.com/turbot/steampipe-postgres-fdw/settings"
1811
"github.com/turbot/steampipe-postgres-fdw/types"
1912
"github.com/turbot/steampipe/pkg/constants"
13+
"github.com/turbot/steampipe/pkg/query/queryresult"
2014
"go.opentelemetry.io/otel"
2115
"go.opentelemetry.io/otel/attribute"
2216
"go.opentelemetry.io/otel/metric"
17+
"log"
18+
"strings"
19+
"sync"
2320
)
2421

2522
type hubBase struct {
@@ -520,20 +517,6 @@ func (h *hubBase) HandleLegacyCacheCommand(command string) error {
520517
return nil
521518
}
522519

523-
func (h *hubBase) cacheTTL(connectionName string) time.Duration {
524-
log.Printf("[INFO] cacheTTL 1")
525-
// if the cache ttl has been overridden, then enforce the value
526-
if h.cacheSettings.Ttl != nil {
527-
return *h.cacheSettings.Ttl
528-
}
529-
log.Printf("[INFO] cacheTTL 2")
530-
531-
const defaultTtl = 300 * time.Second
532-
533-
log.Printf("[INFO] default cacheTTL %v", defaultTtl)
534-
return defaultTtl
535-
}
536-
537520
// GetSortableFields
538521
func (h *hubBase) GetSortableFields(tableName, connectionName string) map[string]proto.SortOrder {
539522
return nil

hub/hub_remote.go

+9-6
Original file line numberDiff line numberDiff line change
@@ -300,16 +300,19 @@ func (h *RemoteHub) cacheEnabled(connectionName string) bool {
300300
}
301301

302302
func (h *RemoteHub) cacheTTL(connectionName string) time.Duration {
303+
// initialise to default
304+
ttl := 300 * time.Second
303305
// if the cache ttl has been overridden, then enforce the value
304306
if h.cacheSettings.Ttl != nil {
305-
return *h.cacheSettings.Ttl
307+
ttl = *h.cacheSettings.Ttl
308+
}
309+
// would this give data earlier than the cacheClearTime
310+
now := time.Now()
311+
if now.Add(-ttl).Before(h.cacheSettings.ClearTime) {
312+
ttl = now.Sub(h.cacheSettings.ClearTime)
306313
}
307314

308-
// default ttl is 300 secs
309-
const defaultTTL = 300 * time.Second
310-
311-
log.Printf("[INFO] default cacheTTL returning %v", defaultTTL)
312-
return defaultTTL
315+
return ttl
313316
}
314317

315318
// resolve the server cache enabled property

version/version.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
)
1212

1313
// The main version number that is being run at the moment.
14-
var fdwVersion = "1.12.0"
14+
var fdwVersion = "1.12.1"
1515

1616
// A pre-release marker for the version. If this is "" (empty string)
1717
// then it means that it is a final release. Otherwise, this is a pre-release

0 commit comments

Comments
 (0)