Skip to content

Commit c499303

Browse files
holimanjagdeep sidhu
authored andcommitted
cmd/utils: double limit on free-disk monitor (ethereum#24781)
This PR doubles the limit on which to trigger automatic shutdown, and also changes the timer to run once every 30s instead of 60s.
1 parent 31e05f9 commit c499303

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

cmd/geth/consolecmd_test.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ func runMinimalGeth(t *testing.T, args ...string) *testgeth {
4242
// --networkid=1337 to avoid cache bump
4343
// --syncmode=full to avoid allocating fast sync bloom
4444
allArgs := []string{"--ropsten", "--networkid", "1337", "--syncmode=full", "--port", "0",
45-
"--nat", "none", "--nodiscover", "--maxpeers", "0", "--cache", "64"}
45+
"--nat", "none", "--nodiscover", "--maxpeers", "0", "--cache", "64",
46+
"--datadir.minfreedisk", "0"}
4647
return runGeth(t, append(allArgs, args...)...)
4748
}
4849

cmd/utils/cmd.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,11 @@ func StartNode(ctx *cli.Context, stack *node.Node, isConsole bool) {
7777
signal.Notify(sigc, syscall.SIGINT, syscall.SIGTERM)
7878
defer signal.Stop(sigc)
7979

80-
minFreeDiskSpace := ethconfig.Defaults.TrieDirtyCache
80+
minFreeDiskSpace := 2 * ethconfig.Defaults.TrieDirtyCache // Default 2 * 256Mb
8181
if ctx.GlobalIsSet(MinFreeDiskSpaceFlag.Name) {
8282
minFreeDiskSpace = ctx.GlobalInt(MinFreeDiskSpaceFlag.Name)
8383
} else if ctx.GlobalIsSet(CacheFlag.Name) || ctx.GlobalIsSet(CacheGCFlag.Name) {
84-
minFreeDiskSpace = ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheGCFlag.Name) / 100
84+
minFreeDiskSpace = 2 * ctx.GlobalInt(CacheFlag.Name) * ctx.GlobalInt(CacheGCFlag.Name) / 100
8585
}
8686
if minFreeDiskSpace > 0 {
8787
go monitorFreeDiskSpace(sigc, stack.InstanceDir(), uint64(minFreeDiskSpace)*1024*1024)
@@ -131,7 +131,7 @@ func monitorFreeDiskSpace(sigc chan os.Signal, path string, freeDiskSpaceCritica
131131
} else if freeSpace < 2*freeDiskSpaceCritical {
132132
log.Warn("Disk space is running low. Geth will shutdown if disk space runs below critical level.", "available", common.StorageSize(freeSpace), "critical_level", common.StorageSize(freeDiskSpaceCritical))
133133
}
134-
time.Sleep(60 * time.Second)
134+
time.Sleep(30 * time.Second)
135135
}
136136
}
137137

0 commit comments

Comments
 (0)