diff --git a/seaweed-block/core/hostlimit/limiter.go b/seaweed-block/core/hostlimit/limiter.go index 17869076e2..b4fded2f61 100644 --- a/seaweed-block/core/hostlimit/limiter.go +++ b/seaweed-block/core/hostlimit/limiter.go @@ -216,6 +216,15 @@ func (l *Limiter) Admit(ctx context.Context, payload int64, abort func(error)) ( return 0, err } if errors.Is(err, ErrConfig) { + l.mu.Lock() + warn := l.stats.LastPoolError != err.Error() + l.stats.LastPoolError = err.Error() + l.stats.Skipped++ + l.stats.SkippedByClass[c]++ + l.mu.Unlock() + if warn { + log.Printf("hostlimit: shared pool configuration refused; background protection may lag: %v", err) + } return 0, err } fallback := err != nil // A is deliberately degraded: no shared memory/spill cap. diff --git a/seaweed-block/core/hostlimit/limiter_test.go b/seaweed-block/core/hostlimit/limiter_test.go index 3c169814ca..3e0693fe2c 100644 --- a/seaweed-block/core/hostlimit/limiter_test.go +++ b/seaweed-block/core/hostlimit/limiter_test.go @@ -164,6 +164,9 @@ func TestFallbackAndConfigMismatch(t *testing.T) { if _, e = b.Admit(context.Background(), 1, nil); !errors.Is(e, ErrConfig) { t.Fatalf("config mismatch bypassed cap: %v", e) } + if st := b.Snapshot().(Stats); st.LastPoolError == "" || st.Skipped != 1 { + t.Fatal("configuration refusal was silent", st) + } c.Directory += "-missing" f := newTest(t, c) x, e = f.Admit(context.Background(), 1, nil)