Skip to content

Commit

Permalink
keep alive http client
Browse files Browse the repository at this point in the history
  • Loading branch information
dholms committed Nov 16, 2023
1 parent 5976564 commit 525303f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions packages/pds/src/migrate-script/migrate-all.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import assert from 'node:assert'
import https from 'node:https'
import axios from 'axios'
import * as plcLib from '@did-plc/lib'
import SqlRepoStorage from '../sql-repo-storage'
Expand All @@ -20,6 +21,11 @@ import {
transferTakedowns,
} from './util'

const httpClient = axios.create({
timeout: 0, //optional
httpsAgent: new https.Agent({ keepAlive: true }),
})

export const runScript = async () => {
console.log('starting')
const { db, ctx, adminHeaders, pdsInfos } = await setupEnv()
Expand Down Expand Up @@ -198,7 +204,7 @@ const doImport = async (
const storage = new SqlRepoStorage(ctx.db, did)
const carStream = await storage.getCarStream(since)

const importRes = await axios.post(
const importRes = await httpClient.post(
`${pds.url}/xrpc/com.atproto.temp.importRepo`,
carStream,
{
Expand Down Expand Up @@ -287,7 +293,7 @@ const lockAndTransfer = async (
)
assert(!txFinished)
const accountRes = await getUserAccount(ctx, status.did)
await axios.post(
await httpClient.post(
`${pds.url}/xrpc/com.atproto.temp.transferAccount`,
{
did: status.did,
Expand Down

0 comments on commit 525303f

Please sign in to comment.