Skip to content

Commit 5f84305

Browse files
committed
Magic number
1 parent 8021a75 commit 5f84305

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

catalog/resource_metastore.go

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"context"
55
"log"
66
"strings"
7+
"time"
78

89
"github.com/databricks/databricks-sdk-go"
910
"github.com/databricks/databricks-sdk-go/service/catalog"
@@ -13,6 +14,8 @@ import (
1314
"golang.org/x/exp/slices"
1415
)
1516

17+
const maxDeltaSharingRecipientTokenLifetimeInSeconds = int64(365 * 24 * time.Hour / time.Second) // 1 year
18+
1619
// This and the next function should be updated together to keep them in sync.
1720
func updateForceSendFieldsWorkspaceLevel(req *catalog.UpdateMetastore) {
1821
if req.DeltaSharingScope != "" && !slices.Contains(req.ForceSendFields, "DeltaSharingRecipientTokenLifetimeInSeconds") {
@@ -31,14 +34,14 @@ func updateForceSendFieldsAccountLevel(req *catalog.UpdateAccountsMetastore) {
3134
func setDefaultDeltaSharingRecipientTokenLifetimeInSecondsWorkspaceLevel(req *catalog.UpdateMetastore) {
3235
if req.DeltaSharingRecipientTokenLifetimeInSeconds == 0 {
3336
log.Printf("[DEBUG] Setting delta sharing recipient token lifetime to 1 year")
34-
req.DeltaSharingRecipientTokenLifetimeInSeconds = 31536000
37+
req.DeltaSharingRecipientTokenLifetimeInSeconds = deltaSharingRecipientTokenLifetimeInSeconds
3538
}
3639
}
3740

3841
func setDefaultDeltaSharingRecipientTokenLifetimeInSecondsAccountLevel(req *catalog.UpdateAccountsMetastore) {
3942
if req.DeltaSharingRecipientTokenLifetimeInSeconds == 0 {
4043
log.Printf("[DEBUG] Setting delta sharing recipient token lifetime to 1 year")
41-
req.DeltaSharingRecipientTokenLifetimeInSeconds = 31536000
44+
req.DeltaSharingRecipientTokenLifetimeInSeconds = deltaSharingRecipientTokenLifetimeInSeconds
4245
}
4346
}
4447

0 commit comments

Comments
 (0)