diff --git a/backend/mempool-config.sample.json b/backend/mempool-config.sample.json index 99b69c208..1c7097de4 100644 --- a/backend/mempool-config.sample.json +++ b/backend/mempool-config.sample.json @@ -44,7 +44,8 @@ }, "ESPLORA": { "REST_API_URL": "http://127.0.0.1:3000", - "UNIX_SOCKET_PATH": "/tmp/esplora-bitcoin-mainnet" + "UNIX_SOCKET_PATH": "/tmp/esplora-bitcoin-mainnet", + "RETRY_UNIX_SOCKET_AFTER": 30000 }, "SECOND_CORE_RPC": { "HOST": "127.0.0.1", diff --git a/backend/src/__fixtures__/mempool-config.template.json b/backend/src/__fixtures__/mempool-config.template.json index 625f3d8a0..6c2269a4f 100644 --- a/backend/src/__fixtures__/mempool-config.template.json +++ b/backend/src/__fixtures__/mempool-config.template.json @@ -45,7 +45,8 @@ }, "ESPLORA": { "REST_API_URL": "__ESPLORA_REST_API_URL__", - "UNIX_SOCKET_PATH": "__ESPLORA_UNIX_SOCKET_PATH__" + "UNIX_SOCKET_PATH": "__ESPLORA_UNIX_SOCKET_PATH__", + "RETRY_UNIX_SOCKET_AFTER": "__ESPLORA_RETRY_UNIX_SOCKET_AFTER__" }, "SECOND_CORE_RPC": { "HOST": "__SECOND_CORE_RPC_HOST__", diff --git a/backend/src/__tests__/config.test.ts b/backend/src/__tests__/config.test.ts index 75b87c6cf..e12f90a86 100644 --- a/backend/src/__tests__/config.test.ts +++ b/backend/src/__tests__/config.test.ts @@ -47,7 +47,7 @@ describe('Mempool Backend Config', () => { expect(config.ELECTRUM).toStrictEqual({ HOST: '127.0.0.1', PORT: 3306, TLS_ENABLED: true }); - expect(config.ESPLORA).toStrictEqual({ REST_API_URL: 'http://127.0.0.1:3000', UNIX_SOCKET_PATH: null }); + expect(config.ESPLORA).toStrictEqual({ REST_API_URL: 'http://127.0.0.1:3000', UNIX_SOCKET_PATH: null, RETRY_UNIX_SOCKET_AFTER: 30000 }); expect(config.CORE_RPC).toStrictEqual({ HOST: '127.0.0.1', diff --git a/docker/README.md b/docker/README.md index e81e45b42..ee5ba11c5 100644 --- a/docker/README.md +++ b/docker/README.md @@ -205,7 +205,8 @@ Corresponding `docker-compose.yml` overrides: ```json "ESPLORA": { "REST_API_URL": "http://127.0.0.1:3000", - "UNIX_SOCKET_PATH": "/tmp/esplora-socket" + "UNIX_SOCKET_PATH": "/tmp/esplora-socket", + "RETRY_UNIX_SOCKET_AFTER": 30000 }, ``` @@ -215,6 +216,7 @@ Corresponding `docker-compose.yml` overrides: environment: ESPLORA_REST_API_URL: "" ESPLORA_UNIX_SOCKET_PATH: "" + ESPLORA_RETRY_UNIX_SOCKET_AFTER: "" ... ``` diff --git a/docker/backend/mempool-config.json b/docker/backend/mempool-config.json index 7d2737e9c..f4543bd2e 100644 --- a/docker/backend/mempool-config.json +++ b/docker/backend/mempool-config.json @@ -43,7 +43,8 @@ }, "ESPLORA": { "REST_API_URL": "__ESPLORA_REST_API_URL__", - "UNIX_SOCKET_PATH": "__ESPLORA_UNIX_SOCKET_PATH__" + "UNIX_SOCKET_PATH": "__ESPLORA_UNIX_SOCKET_PATH__", + "RETRY_UNIX_SOCKET_AFTER": __ESPLORA_RETRY_UNIX_SOCKET_AFTER__ }, "SECOND_CORE_RPC": { "HOST": "__SECOND_CORE_RPC_HOST__", diff --git a/docker/backend/start.sh b/docker/backend/start.sh index 55da48464..c6ce8f1e7 100755 --- a/docker/backend/start.sh +++ b/docker/backend/start.sh @@ -47,6 +47,7 @@ __ELECTRUM_TLS_ENABLED__=${ELECTRUM_TLS_ENABLED:=false} # ESPLORA __ESPLORA_REST_API_URL__=${ESPLORA_REST_API_URL:=http://127.0.0.1:3000} __ESPLORA_UNIX_SOCKET_PATH__=${ESPLORA_UNIX_SOCKET_PATH:=null} +__ESPLORA_RETRY_UNIX_SOCKET_AFTER__=${ESPLORA_RETRY_UNIX_SOCKET_AFTER:=30000} # SECOND_CORE_RPC __SECOND_CORE_RPC_HOST__=${SECOND_CORE_RPC_HOST:=127.0.0.1} @@ -168,6 +169,7 @@ sed -i "s/__ELECTRUM_TLS_ENABLED__/${__ELECTRUM_TLS_ENABLED__}/g" mempool-config sed -i "s!__ESPLORA_REST_API_URL__!${__ESPLORA_REST_API_URL__}!g" mempool-config.json sed -i "s!__ESPLORA_UNIX_SOCKET_PATH__!${__ESPLORA_UNIX_SOCKET_PATH__}!g" mempool-config.json +sed -i "s!__ESPLORA_RETRY_UNIX_SOCKET_AFTER__!${__ESPLORA_RETRY_UNIX_SOCKET_AFTER__}!g" mempool-config.json sed -i "s/__SECOND_CORE_RPC_HOST__/${__SECOND_CORE_RPC_HOST__}/g" mempool-config.json sed -i "s/__SECOND_CORE_RPC_PORT__/${__SECOND_CORE_RPC_PORT__}/g" mempool-config.json