Skip to content

Commit

Permalink
notice
Browse files Browse the repository at this point in the history
Signed-off-by: dsxing <xingdashuaostar@126.com>
  • Loading branch information
dsxing committed Apr 18, 2024
1 parent 54dff2b commit c26a327
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
4 changes: 4 additions & 0 deletions cache/memory/memory.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,10 @@ func (c *InMemoryCache) RemoveContainer(containerName string) error {
return nil
}

func (c *InMemoryCache) GetMaxAge() time.Duration {
return c.maxAge
}

func New(
maxAge time.Duration,
backend []storage.StorageDriver,
Expand Down
4 changes: 3 additions & 1 deletion manager/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ import (

// Housekeeping interval.
var enableLoadReader = flag.Bool("enable_load_reader", false, "Whether to enable cpu load reader")
var HousekeepingInterval = flag.Duration("housekeeping_interval", 1*time.Second, "Interval between container housekeepings")
var HousekeepingInterval = flag.Duration("housekeeping_interval", 1*time.Second, "Interval between container housekeepings."+
" It should be less than 'max_housekeeping_interval',"+
" and it must be less than memory's maxAge('storage_duration'), which is set to 2 minutes by default.")

// TODO: replace regular expressions with something simpler, such as strings.Split().
// cgroup type chosen to fetch the cgroup path of a process.
Expand Down
4 changes: 4 additions & 0 deletions manager/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,10 @@ func New(memoryCache *memory.InMemoryCache, sysfs sysfs.SysFs, HousekeepingConfi
return nil, err
}

if *HousekeepingInterval >= memoryCache.GetMaxAge() {
return nil, fmt.Errorf("invalid housekeeping_interval setting, it must be less than memory's maxAge('storage_duration'), which is set to 2 minutes by default.")
}

fsInfo, err := fs.NewFsInfo(context)
if err != nil {
return nil, err
Expand Down

0 comments on commit c26a327

Please sign in to comment.