add exclusive lock library on shell

This commit is contained in:
Chris Lu
2020-04-23 02:31:04 -07:00
parent 77873b832b
commit 30ee4f3291
5 changed files with 257 additions and 179 deletions

View File

@@ -2,6 +2,7 @@ package weed_server
import (
"context"
"fmt"
"math/rand"
"time"
@@ -72,8 +73,7 @@ func (ms *MasterServer) LeaseAdminToken(ctx context.Context, req *master_pb.Leas
return resp, nil
}
// refuse since still locked
resp.Error = "already locked"
return resp, nil
return resp, fmt.Errorf("already locked")
}
// for fresh lease request
ts, token := ms.generateToken()