|
68 | 68 | * | `ECHO_HEADERS` | A debug flag to indicate whether you want to output request and response headers | `false` |
|
69 | 69 | * | `USE_DELEGATED_ROUTING` | Whether to use the delegated routing v1 API | `true` |
|
70 | 70 | * | `DELEGATED_ROUTING_V1_HOST` | Hostname to use for delegated routing v1 | `https://delegated-ipfs.dev` |
|
71 |
| - * | `RECOVERABLE_ERRORS` | A comma delimited list of errors to recover from. These errors are checked in `uncaughtException` and `unhandledRejection` callbacks | `all` | |
72 | 71 | *
|
73 | 72 | * <!--
|
74 | 73 | * TODO: currently broken when used in docker, but they work when running locally (you can cache datastore and blockstore locally to speed things up if you want)
|
@@ -161,7 +160,7 @@ import cors from '@fastify/cors'
|
161 | 160 | import { createVerifiedFetch } from '@helia/verified-fetch'
|
162 | 161 | import fastify, { type FastifyInstance, type RouteOptions } from 'fastify'
|
163 | 162 | import metricsPlugin from 'fastify-metrics'
|
164 |
| -import { HOST, HTTP_PORT, RPC_PORT, METRICS, ECHO_HEADERS, FASTIFY_DEBUG, RECOVERABLE_ERRORS, ALLOW_UNHANDLED_ERROR_RECOVERY } from './constants.js' |
| 163 | +import { HOST, HTTP_PORT, RPC_PORT, METRICS, ECHO_HEADERS, FASTIFY_DEBUG } from './constants.js' |
165 | 164 | import { contentTypeParser } from './content-type-parser.js'
|
166 | 165 | import { getCustomHelia } from './get-custom-helia.js'
|
167 | 166 | import { httpGateway } from './helia-http-gateway.js'
|
@@ -232,18 +231,6 @@ async function closeGracefully (signal: number | string): Promise<void> {
|
232 | 231 | process.once(signal, closeGracefully)
|
233 | 232 | })
|
234 | 233 |
|
235 |
| -const uncaughtHandler = (error: any): void => { |
236 |
| - log.error('Uncaught Exception:', error) |
237 |
| - if (ALLOW_UNHANDLED_ERROR_RECOVERY && (RECOVERABLE_ERRORS === 'all' || RECOVERABLE_ERRORS.includes(error?.code) || RECOVERABLE_ERRORS.includes(error?.name))) { |
238 |
| - log.trace('Ignoring error') |
239 |
| - return |
240 |
| - } |
241 |
| - void closeGracefully('SIGTERM') |
242 |
| -} |
243 |
| - |
244 |
| -process.on('uncaughtException', uncaughtHandler) |
245 |
| -process.on('unhandledRejection', uncaughtHandler) |
246 |
| - |
247 | 234 | interface ServerOptions {
|
248 | 235 | metrics: boolean
|
249 | 236 | }
|
|
0 commit comments