PeerTube/shared/extra-utils/server/follows.ts

21 lines
497 B
TypeScript
Raw Normal View History

import { waitJobs } from './jobs'
2021-07-07 02:16:40 -05:00
import { ServerInfo } from './servers'
2017-11-21 06:43:29 -06:00
2017-11-17 04:35:10 -06:00
async function doubleFollow (server1: ServerInfo, server2: ServerInfo) {
await Promise.all([
2021-07-07 02:16:40 -05:00
server1.followsCommand.follow({ targets: [ server2.url ] }),
server2.followsCommand.follow({ targets: [ server1.url ] })
2017-11-17 04:35:10 -06:00
])
// Wait request propagation
await waitJobs([ server1, server2 ])
2017-11-17 04:35:10 -06:00
return true
}
2017-11-16 10:16:42 -06:00
// ---------------------------------------------------------------------------
export {
2021-07-07 02:16:40 -05:00
doubleFollow
2017-11-16 10:16:42 -06:00
}