aboutsummaryrefslogtreecommitdiffhomepage
path: root/packages/server-commands/src/server/follows.ts
blob: 32304495aaad3f5977b027d40a5dd7e09e8f6a65 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import { waitJobs } from './jobs.js'
import { PeerTubeServer } from './server.js'

async function doubleFollow (server1: PeerTubeServer, server2: PeerTubeServer) {
  await Promise.all([
    server1.follows.follow({ hosts: [ server2.url ] }),
    server2.follows.follow({ hosts: [ server1.url ] })
  ])

  // Wait request propagation
  await waitJobs([ server1, server2 ])

  return true
}

// ---------------------------------------------------------------------------

export {
  doubleFollow
}