*: replace 3600 seconds with 1 hour
Signed-off-by: Samuel Karp <skarp@amazon.com>
This commit is contained in:
parent
b8f4c7a9bd
commit
9665a2650a
@ -113,7 +113,7 @@ var createCommand = cli.Command{
|
||||
cli.DurationFlag{
|
||||
Name: "expires, x",
|
||||
Usage: "expiration of lease (0 value will not expire)",
|
||||
Value: 24 * 3600 * time.Second,
|
||||
Value: 24 * time.Hour,
|
||||
},
|
||||
},
|
||||
Action: func(context *cli.Context) error {
|
||||
|
2
lease.go
2
lease.go
@ -34,7 +34,7 @@ func (c *Client) WithLease(ctx context.Context) (context.Context, func(context.C
|
||||
|
||||
ls := c.LeasesService()
|
||||
|
||||
l, err := ls.Create(ctx, leases.WithRandomID(), leases.WithExpiration(24*3600*time.Second))
|
||||
l, err := ls.Create(ctx, leases.WithRandomID(), leases.WithExpiration(24*time.Hour))
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
@ -420,12 +420,12 @@ func (cs *contentStore) Writer(ctx context.Context, opts ...content.WriterOpt) (
|
||||
}
|
||||
if !leased {
|
||||
// Add timestamp to allow aborting once stale
|
||||
// When lease is set the ingest shoudl be aborted
|
||||
// When lease is set the ingest should be aborted
|
||||
// after lease it belonged to is deleted.
|
||||
// Expiration can be configurable in the future to
|
||||
// give more control to the daemon, however leases
|
||||
// already give users more control of expiration.
|
||||
expireAt := time.Now().UTC().Add(24 * 3600 * time.Second)
|
||||
expireAt := time.Now().UTC().Add(24 * time.Hour)
|
||||
if err := writeExpireAt(expireAt, bkt); err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -55,7 +55,7 @@ func TestGCRoots(t *testing.T) {
|
||||
addContent("ns2", dgst(9), nil),
|
||||
addIngest("ns1", "ingest-1", "", nil), // will be seen as expired
|
||||
addIngest("ns1", "ingest-2", "", timeIn(0)), // expired
|
||||
addIngest("ns1", "ingest-3", "", timeIn(3600*time.Second)),
|
||||
addIngest("ns1", "ingest-3", "", timeIn(time.Hour)),
|
||||
addIngest("ns2", "ingest-4", "", nil),
|
||||
addIngest("ns2", "ingest-5", dgst(8), nil),
|
||||
addIngest("ns2", "ingest-6", "", nil), // added to expired lease
|
||||
@ -73,7 +73,7 @@ func TestGCRoots(t *testing.T) {
|
||||
addLeaseSnapshot("ns2", "l2", "overlay", "sn6"),
|
||||
addLeaseContent("ns2", "l1", dgst(4)),
|
||||
addLeaseContent("ns2", "l2", dgst(5)),
|
||||
addLease("ns2", "l3", labelmap(string(labelGCExpire), time.Now().Add(3600*time.Second).Format(time.RFC3339))),
|
||||
addLease("ns2", "l3", labelmap(string(labelGCExpire), time.Now().Add(time.Hour).Format(time.RFC3339))),
|
||||
addLeaseContent("ns2", "l3", dgst(6)),
|
||||
addLeaseSnapshot("ns2", "l3", "overlay", "sn7"),
|
||||
addLeaseIngest("ns2", "l3", "ingest-4"),
|
||||
@ -156,7 +156,7 @@ func TestGCRemove(t *testing.T) {
|
||||
addSnapshot("ns1", "overlay", "sn3", "", labelmap(string(labelGCRoot), "always")),
|
||||
addSnapshot("ns1", "overlay", "sn4", "", nil),
|
||||
addSnapshot("ns2", "overlay", "sn1", "", nil),
|
||||
addLease("ns1", "l1", labelmap(string(labelGCExpire), time.Now().Add(3600*time.Second).Format(time.RFC3339))),
|
||||
addLease("ns1", "l1", labelmap(string(labelGCExpire), time.Now().Add(time.Hour).Format(time.RFC3339))),
|
||||
addLease("ns2", "l2", labelmap(string(labelGCExpire), time.Now().Format(time.RFC3339))),
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user