aboutsummaryrefslogblamecommitdiffhomepage
path: root/shared/extra-utils/server/follows.ts
blob: 698238f29e89dff43f8d76c124011eace1136a56 (plain) (tree)
1
2
3
4
5
6
7
8
9
                                 
                                         
 
                                                                                
                     

                                                       

    
                             
                                      
 


             


                                                                              
              
 
import { waitJobs } from './jobs'
import { PeerTubeServer } from './server'

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
}