From cab633ffeda6327b419fc5200827931950b4617e Mon Sep 17 00:00:00 2001 From: Roman Khimov Date: Fri, 1 Jul 2022 23:31:25 +0300 Subject: [PATCH] oracle: make double-Shutdown a no-op --- pkg/services/oracle/oracle.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pkg/services/oracle/oracle.go b/pkg/services/oracle/oracle.go index 1882d49d0..168ff2630 100644 --- a/pkg/services/oracle/oracle.go +++ b/pkg/services/oracle/oracle.go @@ -181,6 +181,12 @@ func (o *Oracle) Name() string { // Shutdown shutdowns Oracle. func (o *Oracle) Shutdown() { + o.respMtx.Lock() + defer o.respMtx.Unlock() + if !o.running { + return + } + o.running = false close(o.close) o.getBroadcaster().Shutdown() }