only start listening when it's needed

This commit is contained in:
kiwiidb
2022-02-04 18:00:08 +01:00
parent 505f592265
commit 56d03e8f40
2 changed files with 3 additions and 2 deletions

View File

@@ -69,6 +69,7 @@ func TestCreateUserTestSuite(t *testing.T) {
func LndHubTestServiceInit() (*service.LndhubService, error) {
// change this if you want to run tests using sqlite
// dbUri := "file:data_test.db"
//make sure the datbase is empty every time you run the test suite
dbUri := "postgresql://user:password@localhost/lndhub?sslmode=disable"
c := &service.Config{
DatabaseUri: dbUri,
@@ -120,7 +121,5 @@ func LndHubTestServiceInit() (*service.LndhubService, error) {
logger.Fatalf("Failed to parse node IdentityPubkey: %v", err)
}
svc.IdentityPubkey = identityPubKey
// Subscribe to LND invoice updates in the background
go svc.InvoiceUpdateSubscription(context.Background())
return svc, nil
}

View File

@@ -47,6 +47,8 @@ func (suite *IncomingPaymentTestSuite) SetupSuite() {
if err != nil {
log.Fatalf("Error initializing test service: %v", err)
}
// Subscribe to LND invoice updates in the background
go svc.InvoiceUpdateSubscription(context.Background())
suite.service = svc
e := echo.New()