keep announcing peer to not fall off the list

This commit is contained in:
Ulf Gebhardt 2022-03-22 01:05:26 +01:00
parent f40d8f8fbc
commit 53c943ff86
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9

View File

@ -7,6 +7,7 @@ const TOPIC = DHT.hash(Buffer.from('GRADIDO'))
const POLLTIME = 20000 const POLLTIME = 20000
const SUCCESSTIME = 120000 const SUCCESSTIME = 120000
const ERRORTIME = 240000 const ERRORTIME = 240000
const ANNOUNCETIME = 30000
const nodeRand = between(1, 99) const nodeRand = between(1, 99)
const nodeURL = `https://test${nodeRand}.org` const nodeURL = `https://test${nodeRand}.org`
const nodeAPI = { const nodeAPI = {
@ -39,7 +40,10 @@ const main = async () => {
await server.listen() await server.listen()
await node.announce(TOPIC, keyPair).finished() setInterval(async () => {
console.log('Announcing on topic:', TOPIC.toString('hex'))
await node.announce(TOPIC, keyPair).finished()
}, ANNOUNCETIME)
let successfulRequests: string[] = [] let successfulRequests: string[] = []
let errorfulRequests: string[] = [] let errorfulRequests: string[] = []