mirror of
https://github.com/libp2p/go-libp2p-peerstore.git
synced 2025-02-06 06:20:06 +08:00
rename GCPruneInterval to GCPurgeInterval for consistency.
This commit is contained in:
parent
bbff6b7522
commit
c3c24b227a
@ -272,7 +272,7 @@ func (ab *dsAddrBook) background() {
|
|||||||
go func() {
|
go func() {
|
||||||
select {
|
select {
|
||||||
case <-time.After(ab.opts.GCInitialDelay):
|
case <-time.After(ab.opts.GCInitialDelay):
|
||||||
pruneTimer = time.NewTicker(ab.opts.GCPruneInterval)
|
pruneTimer = time.NewTicker(ab.opts.GCPurgeInterval)
|
||||||
lookaheadTimer = time.NewTicker(ab.opts.GCLookaheadInterval)
|
lookaheadTimer = time.NewTicker(ab.opts.GCLookaheadInterval)
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
@ -40,7 +40,7 @@ func TestGCLookahead(t *testing.T) {
|
|||||||
// effectively disable automatic GC for this test.
|
// effectively disable automatic GC for this test.
|
||||||
opts.GCInitialDelay = 90 * time.Hour
|
opts.GCInitialDelay = 90 * time.Hour
|
||||||
opts.GCLookaheadInterval = 10 * time.Second
|
opts.GCLookaheadInterval = 10 * time.Second
|
||||||
opts.GCPruneInterval = 1 * time.Minute
|
opts.GCPurgeInterval = 1 * time.Minute
|
||||||
|
|
||||||
factory := addressBookFactory(t, badgerStore, opts)
|
factory := addressBookFactory(t, badgerStore, opts)
|
||||||
ab, closeFn := factory()
|
ab, closeFn := factory()
|
||||||
@ -85,7 +85,7 @@ func TestGCPurging(t *testing.T) {
|
|||||||
// effectively disable automatic GC for this test.
|
// effectively disable automatic GC for this test.
|
||||||
opts.GCInitialDelay = 90 * time.Hour
|
opts.GCInitialDelay = 90 * time.Hour
|
||||||
opts.GCLookaheadInterval = 20 * time.Second
|
opts.GCLookaheadInterval = 20 * time.Second
|
||||||
opts.GCPruneInterval = 1 * time.Minute
|
opts.GCPurgeInterval = 1 * time.Minute
|
||||||
|
|
||||||
factory := addressBookFactory(t, badgerStore, opts)
|
factory := addressBookFactory(t, badgerStore, opts)
|
||||||
ab, closeFn := factory()
|
ab, closeFn := factory()
|
||||||
|
@ -37,7 +37,7 @@ func TestDsAddrBook(t *testing.T) {
|
|||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
opts := DefaultOpts()
|
opts := DefaultOpts()
|
||||||
opts.GCPruneInterval = 1 * time.Second
|
opts.GCPurgeInterval = 1 * time.Second
|
||||||
opts.CacheSize = 1024
|
opts.CacheSize = 1024
|
||||||
|
|
||||||
pt.TestAddrBook(t, addressBookFactory(t, dsFactory, opts))
|
pt.TestAddrBook(t, addressBookFactory(t, dsFactory, opts))
|
||||||
@ -47,7 +47,7 @@ func TestDsAddrBook(t *testing.T) {
|
|||||||
t.Parallel()
|
t.Parallel()
|
||||||
|
|
||||||
opts := DefaultOpts()
|
opts := DefaultOpts()
|
||||||
opts.GCPruneInterval = 1 * time.Second
|
opts.GCPurgeInterval = 1 * time.Second
|
||||||
opts.CacheSize = 0
|
opts.CacheSize = 0
|
||||||
|
|
||||||
pt.TestAddrBook(t, addressBookFactory(t, dsFactory, opts))
|
pt.TestAddrBook(t, addressBookFactory(t, dsFactory, opts))
|
||||||
|
@ -19,7 +19,7 @@ type Options struct {
|
|||||||
CacheSize uint
|
CacheSize uint
|
||||||
|
|
||||||
// Sweep interval to purge expired addresses from the datastore.
|
// Sweep interval to purge expired addresses from the datastore.
|
||||||
GCPruneInterval time.Duration
|
GCPurgeInterval time.Duration
|
||||||
|
|
||||||
// Interval to renew the GC lookahead window.
|
// Interval to renew the GC lookahead window.
|
||||||
GCLookaheadInterval time.Duration
|
GCLookaheadInterval time.Duration
|
||||||
@ -36,7 +36,7 @@ type Options struct {
|
|||||||
func DefaultOpts() Options {
|
func DefaultOpts() Options {
|
||||||
return Options{
|
return Options{
|
||||||
CacheSize: 1024,
|
CacheSize: 1024,
|
||||||
GCPruneInterval: 5 * time.Minute,
|
GCPurgeInterval: 5 * time.Minute,
|
||||||
GCLookaheadInterval: 12 * time.Hour,
|
GCLookaheadInterval: 12 * time.Hour,
|
||||||
GCInitialDelay: 60 * time.Second,
|
GCInitialDelay: 60 * time.Second,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user