From 12810d63bcdc551ef6446e18e08815cdbb2fc74d Mon Sep 17 00:00:00 2001 From: Paul Miller Date: Tue, 26 Jan 2021 09:23:57 -0800 Subject: [PATCH] tell users they can't go higher than 5 minutes (#202) * tell users they can't go higer than 5 minutes * Update version in namespace.go Co-authored-by: Joel Hendrix --- namespace.go | 7 ++++--- subscription_manager.go | 5 +++++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/namespace.go b/namespace.go index d8e1a62..77f49eb 100644 --- a/namespace.go +++ b/namespace.go @@ -26,6 +26,9 @@ import ( "context" "crypto/tls" "fmt" + "runtime" + "strings" + "github.com/Azure/azure-amqp-common-go/v3/aad" "github.com/Azure/azure-amqp-common-go/v3/auth" "github.com/Azure/azure-amqp-common-go/v3/cbs" @@ -34,8 +37,6 @@ import ( "github.com/Azure/go-amqp" "github.com/Azure/go-autorest/autorest/azure" "nhooyr.io/websocket" - "runtime" - "strings" ) const ( @@ -48,7 +49,7 @@ const ( //` // Version is the semantic version number - Version = "0.10.7" + Version = "0.10.9" rootUserAgent = "/golang-service-bus" diff --git a/subscription_manager.go b/subscription_manager.go index 343d040..27fc9d3 100644 --- a/subscription_manager.go +++ b/subscription_manager.go @@ -4,6 +4,7 @@ import ( "context" "encoding/xml" "errors" + "fmt" "io/ioutil" "net/http" "strings" @@ -512,6 +513,10 @@ func SubscriptionWithLockDuration(window *time.Duration) SubscriptionManagementO duration := time.Duration(1 * time.Minute) window = &duration } + if *window > time.Duration(5*time.Minute) { + return fmt.Errorf("Lock duration must be shorter than 5 minutes got: %v", *window) + } + s.LockDuration = ptrString(durationTo8601Seconds(*window)) return nil }