fix(proxy): align shutdown and custom diff fallback

Co-Authored-By: Virgil <virgil@lethean.io>
This commit is contained in:
Virgil 2026-04-04 17:41:59 +00:00 committed by Snider
parent 42a6b438ab
commit 25c4d86ee8
3 changed files with 9 additions and 10 deletions

View file

@ -183,12 +183,6 @@ func (p *Proxy) Stop() {
server.Stop()
}
stopHTTPServer(p)
if p.accessLogger != nil {
p.accessLogger.close()
}
if p.shareLogger != nil {
p.shareLogger.close()
}
if p.watcher != nil {
p.watcher.Stop()
}
@ -216,6 +210,13 @@ func (p *Proxy) Stop() {
shutdown.Disconnect()
}
if p.accessLogger != nil {
p.accessLogger.close()
}
if p.shareLogger != nil {
p.shareLogger.close()
}
select {
case <-p.done:
default:

View file

@ -162,8 +162,6 @@ func (customDiff *CustomDiff) OnLogin(event Event) {
event.Miner.SetCustomDiff(value)
return
}
event.Miner.SetCustomDiff(0)
return
}
if customDiff == nil {

View file

@ -51,7 +51,7 @@ func TestCustomDiff_OnLogin_Bad(t *testing.T) {
func TestCustomDiff_OnLogin_Ugly(t *testing.T) {
miner := &Miner{user: "wallet+bad"}
NewCustomDiff(100).OnLogin(Event{Miner: miner})
if miner.User() != "wallet+bad" || miner.CustomDiff() != 0 {
t.Fatalf("expected invalid suffix to preserve user and leave diff unset, got user=%q diff=%d", miner.User(), miner.CustomDiff())
if miner.User() != "wallet+bad" || miner.CustomDiff() != 100 {
t.Fatalf("expected invalid suffix to preserve user and fall back to global diff, got user=%q diff=%d", miner.User(), miner.CustomDiff())
}
}