laserproxy: extend deadline to 60min & random changes
Change-Id: I2601d2da8da567d8dd6beecc630de911d5d161c3
diff --git a/hswaw/laserproxy/locker.go b/hswaw/laserproxy/locker.go
index 044e832..8080e9b 100644
--- a/hswaw/laserproxy/locker.go
+++ b/hswaw/laserproxy/locker.go
@@ -51,7 +51,7 @@
addr string
}
-func (s *service) runLocker(ctx context.Context, ctrlC chan *lockCtrl) {
+func (s *service) runLocker(ctx context.Context, ctrlC chan *lockCtrl, ownershipDuration time.Duration) {
glog.Infof("Locker starting...")
var curNote string
@@ -94,7 +94,7 @@
won = true
curNote = ctrl.take.note
curAddr = ctrl.take.addr
- curDeadline = time.Now().Add(15 * time.Minute)
+ curDeadline = time.Now().Add(ownershipDuration)
notify()
glog.Infof("Lock taken by %q %q", curNote, curAddr)
}
@@ -121,7 +121,7 @@
}()
case ctrl.bump != nil:
if curAddr != "" {
- curDeadline = time.Now().Add(15 * time.Minute)
+ curDeadline = time.Now().Add(ownershipDuration)
}
case ctrl.subscribe != nil:
subscribers = append(subscribers, ctrl.subscribe.subscriber)