File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed
Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -26,8 +26,8 @@ const appModulePath = require('app-module-path')
2626appModulePath . addPath ( path . join ( __dirname , '../' ) )
2727
2828export async function main ( ) {
29- await ensureConnection ( )
3029 try {
30+ await ensureConnection ( )
3131 const anonymousToken = await getAnonymousToken ( )
3232 const configurations = await getInMemoryEventConfigurations (
3333 `Bearer ${ anonymousToken } `
Original file line number Diff line number Diff line change 99 * Copyright (C) The OpenCRVS Authors located at https://github.com/opencrvs/opencrvs-core/blob/master/AUTHORS.
1010 */
1111import { Readable , Transform , PassThrough } from 'node:stream'
12+ import { Agent } from 'node:http'
1213import fetch from 'node-fetch'
1314import { JsonStreamStringify } from 'json-stream-stringify'
1415import { EventDocument } from '@opencrvs/commons/events'
@@ -98,7 +99,10 @@ export async function reindex(token: TokenWithBearer) {
9899 } ,
99100 // Converts object stream to JSON string stream so that it can
100101 // be sent to the country config reindex endpoint
101- body : new JsonStreamStringify ( eventDocumentStreamForCountryConfig )
102+ body : new JsonStreamStringify ( eventDocumentStreamForCountryConfig ) ,
103+ // Ensure HTTP socket of previous GET /events request is not reused
104+ // to avoid connections being closed preemptively by Node.js
105+ agent : new Agent ( { keepAlive : false } )
102106 }
103107 ) . then ( ( response ) => {
104108 if ( ! response . ok && response . status === 404 ) {
You can’t perform that action at this time.
0 commit comments