From 783fb4b71c42a0e7a3443d9247e428d0f8aafee7 Mon Sep 17 00:00:00 2001 From: kiwiidb Date: Fri, 7 Apr 2023 15:04:47 +0200 Subject: [PATCH 1/2] prevent EOF loop --- rabbitmq/rabbitmq.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/rabbitmq/rabbitmq.go b/rabbitmq/rabbitmq.go index 1d668da5..47d378dd 100644 --- a/rabbitmq/rabbitmq.go +++ b/rabbitmq/rabbitmq.go @@ -198,7 +198,10 @@ func (client *DefaultClient) SubscribeToLndInvoices(ctx context.Context, handler select { case <-ctx.Done(): return context.Canceled - case delivery := <-deliveryChan: + case delivery, ok := <-deliveryChan: + if !ok { + return fmt.Errorf("Disconnected from RabbitMQ") + } var invoice lnrpc.Invoice err := json.Unmarshal(delivery.Body, &invoice) From e16794029b7da1646d1fd78cf129000287cd3556 Mon Sep 17 00:00:00 2001 From: kiwiidb Date: Fri, 7 Apr 2023 15:06:52 +0200 Subject: [PATCH 2/2] add sentry capture --- main.go | 1 + 1 file changed, 1 insertion(+) diff --git a/main.go b/main.go index 1c962f69..9a91f0e5 100644 --- a/main.go +++ b/main.go @@ -205,6 +205,7 @@ func main() { err = svc.RabbitMQClient.SubscribeToLndInvoices(backGroundCtx, svc.ProcessInvoiceUpdate) if err != nil && err != context.Canceled { // in case of an error in this routine, we want to restart LNDhub + sentry.CaptureException(err) svc.Logger.Fatal(err) }