Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?

test details

contentRouting.findProviders

real browser dht network network size 85 kbucket 20 maxPeers 40 randomWalk off visible connection churn due to maxPeers

findProviders: async (key) => {
  if (!this.node._dht) throw new Error('Dht doesnt exist')
  const start = Date.now()
  const cid = await makeKeyId(Buffer.from(key))
  const providers = await pify(cb => node.contentRouting.findProviders(cid, 10 * 1000, cb))()
  // map to id strings
  const providerIds = providers.map(provider => provider.id.toB58String())
  // remove self
  const providerPeerIds = providerIds.filter(providerId => clientId !== providerId)
  const time = Date.now() - start
  return { time, result: providerPeerIds }
}

results

clientId time providerPeerIds.length key error.message

QmaR2RkhRVbHteN3HkTxwbczCXmcs3aGXzg4WjJ76E5kvu	10	20	"group-2"	undefined
QmNtSYvwEJ2g6KoUmoHcDgcdonjuEDfKpnjtrqf3J84ftr	888	0	"group-84"	undefined
QmRzUML1qPam4jii8pgwM5MUTm4CnnuxLVwMCQNWFnLJwr	1057	0	"group-9"	undefined
QmXi3dMzzUGFHoX3Fqrrv6wtYbDdAwWbo2N48D4NnJcKAm	1145	1	"group-30"	undefined
QmUS4rSFeYXVF9fjftdEqCUX7qBJZ9iBdeyTWTWDPyQou7	1183	0	"group-58"	undefined
QmVVvJQGhcmWZodL9zBbKmTBQ8hnpPXHkTbPP2j5ieegYP	1234	3	"group-9"	undefined
QmYhKytoUim3EKvegRabNe8u99LhSTDKPRvwuJKRdSqetx	2075	0	"group-23"	undefined
QmaEmtWCzFdQQTpoJJWDqrxsC8ALDLdyb319Ef7qChmKPo	4082	0	"group-59"	undefined
QmYksHXtr6REkF3Ub9dD71tHJ5qfvYbEFwmwsZC7Y9vuKz	5310	0	"group-54"	undefined
QmezTcncH7Gpkt8NDRnWcbgbYaEvXM87EsukSdsQDrBZDR	6933	6	"group-1"	undefined

QmPWn85knkLNQYiMwcALVZnCVptW6Mh31ack2qDPudPu6q	1223	0	"group-74"	undefined
QmYPDD1s57vTyyzjBck3XFnA8ng9J1ufm6erRGqnA23srw	1014	0	"group-56"	undefined
QmUT6CWYgvW8xX7HDoza3LAak6XEsddMEbaBiEp5HApfei	1714	2	"group-9"	undefined
QmaHz7ycyWdTVoBj5QLJVceowtngpDyCGQrvhiXZWQT1XF	1630	1	"group-61"	undefined
QmbKrzgHyoPJX34kDCgpu43Dmehr4Y6Ad45senzLqKMcZt	1143	0	"group-30"	undefined
QmacdFXNnLrTQYb7abV8rt9AYdQPNrgZzP7P1TZLhXwgm7	1345	0	"group-94"	undefined
QmaEmtWCzFdQQTpoJJWDqrxsC8ALDLdyb319Ef7qChmKPo	1482	3	"group-14"	undefined
QmT4KhhWWbdzLch2VkER9q8DFtFTqwF1H4vt1iCVJ6Ai62	2973	5	"group-58"	undefined
QmVfAFccscquV1vFqvSabbA8EAGwftDEvhW9o28hk3CTVh	10006	0	"group-84"	undefined
QmezTcncH7Gpkt8NDRnWcbgbYaEvXM87EsukSdsQDrBZDR	7220	0	"group-8"	undefined

QmYmujvY8duDFNdsFcebPBpfn2sVntTzmSsY4aZ8RWYq1o	undefined	0	"group-56"	"Callback function "anonymous" timed out."
QmS5MKH4wQdqoS95umMA74bzMJbLNzBQGVjY8y8u8jXR4y	848	0	"group-99"	undefined
QmVfAFccscquV1vFqvSabbA8EAGwftDEvhW9o28hk3CTVh	2961	1	"group-27"	undefined
QmR4WcGipKUCScdAn216TnuppiNLGDf6qjg65nS6mkmqCY	2444	1	"group-58"	undefined
QmYPDD1s57vTyyzjBck3XFnA8ng9J1ufm6erRGqnA23srw	2215	0	"group-41"	undefined
QmacdFXNnLrTQYb7abV8rt9AYdQPNrgZzP7P1TZLhXwgm7	2120	1	"group-7"	undefined
QmTuDFeq9zKpUuBbM9qWDynWiMZLMEaRaYqJEasYBGSw9b	17	0	"group-67"	undefined
QmdpaiVuhwWmFCKUqyezezZfzBjsoQKjQTh9ujtpPi4E77	1546	2	"group-54"	undefined
QmPWn85knkLNQYiMwcALVZnCVptW6Mh31ack2qDPudPu6q	1032	1	"group-19"	undefined
QmT4KhhWWbdzLch2VkER9q8DFtFTqwF1H4vt1iCVJ6Ai62	10010	3	"group-23"	undefined

QmTyLqPomDhJ9RyB5LX99RVFTEFELridDY3h89TvPkV137	1702	0	"group-9"	undefined
QmWgiofrC4JRrkK5ZGjMg5w6wVKPmSh2DWn6aG31vkhpt8	8	0	"group-44"	undefined
QmRHSZxy22smQQqy8cptsAwhLXw5p8UBRaZo9pVcm9Ne33	1926	0	"group-74"	undefined
QmXSxxW93x1d439Rxeyk4jgPHS8pn5wsif3xk1oRCWua5t	1564	0	"group-99"	undefined
QmZKRn9CsWkA6SQnDevxg3c1J42wj2ZeD1rnFd32H9rYjf	62	20	"group-2"	undefined
QmRzUML1qPam4jii8pgwM5MUTm4CnnuxLVwMCQNWFnLJwr	1640	0	"group-74"	undefined
QmReEUpjsFkRorUEcELsX5fQyzV5hMcZWPeR2aLAjurSX6	1385	4	"group-28"	undefined
QmdMKTJhtrkuEWferndf1Dz1yEbK2YPjqSXin1tC71fvqN	1920	0	"group-26"	undefined
QmT4KhhWWbdzLch2VkER9q8DFtFTqwF1H4vt1iCVJ6Ai62	4972	0	"group-19"	undefined
QmfVD34LzPwEs45EdG7YCBcxwJ7TA4trwRSEUZjw3hQHnz	undefined	0	"group-63"	"Timeout occurred."

QmbEiQnFjmDqqFDKg4tPUp7rqRrL2A8PPNeV9cEwkoYfwg	65	19	"group-1"	undefined
QmUyxmnJWsa9uAXN8H15Af5VArTCze8HRXYy3fakzeZpog	1363	2	"group-43"	undefined
QmU4FwUR2budxfxoiTrigFgkd6TKNQhe33LFkdnWhzKoAb	1149	4	"group-59"	undefined
QmReEUpjsFkRorUEcELsX5fQyzV5hMcZWPeR2aLAjurSX6	782	5	"group-18"	undefined
Qmdvd8NXGhyS3JT6UdBBCaaCPM8VukCZAqwndUwyrbdbLd	1899	0	"group-63"	undefined
QmcBzrzsL9JzcZb2rCz2ww3gRWTTxGBYryfYrr77Nk6xuh	1289	1	"group-63"	undefined
QmaEmtWCzFdQQTpoJJWDqrxsC8ALDLdyb319Ef7qChmKPo	10015	3	"group-16"	undefined
QmYksHXtr6REkF3Ub9dD71tHJ5qfvYbEFwmwsZC7Y9vuKz	10004	2	"group-9"	undefined
QmbKrzgHyoPJX34kDCgpu43Dmehr4Y6Ad45senzLqKMcZt	1126	1	"group-54"	undefined
QmacdFXNnLrTQYb7abV8rt9AYdQPNrgZzP7P1TZLhXwgm7	undefined	0	"group-9"	"Callback function "ano

QmQb6p4F4cvKVBs857mvNjgb7jJnftH3To5NvjecYS4kd9	7	0	"group-44"	undefined
QmYPDD1s57vTyyzjBck3XFnA8ng9J1ufm6erRGqnA23srw	216	20	"group-1"	undefined
QmRzUML1qPam4jii8pgwM5MUTm4CnnuxLVwMCQNWFnLJwr	936	0	"group-25"	undefined
QmYxBfiEpFVucePbN5BVRCJ4Dsdh96jYm8TMYgWaoyJWkc	1255	0	"group-61"	undefined
QmYxu7rVeRVVhx9UXbTmodfwwQkzNNfNLnoaV98vKF15x4	1274	0	"group-25"	undefined
Qme2eY7ZdtkPstENUFph4uEXDintdsifhwHVgZJG8E46iv	1422	0	"group-32"	undefined
Qmevz8HBTnD1dKMAxRezEEA9q7FEbmxZjyjoHT43uEH7g7	1547	1	"group-38"	undefined
QmQSnSVWc6jpuSXQyvzwovU1bawhPCSX6h7CLA8FzjvBff	4184	2	"group-53"	undefined
QmT4KhhWWbdzLch2VkER9q8DFtFTqwF1H4vt1iCVJ6Ai62	4541	1	"group-100"	undefined
QmSDwgdH4J2JDc8X48MFChDLieppcSc9QNpuRWKVVEgUPm	8504	4	"group-9"	undefined
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.