mirror of
https://github.com/irislib/iris-messenger.git
synced 2024-09-19 17:46:33 +00:00
add timeout to getExtendedFollows
This commit is contained in:
parent
b1656419ce
commit
a608a4ae65
@ -60,12 +60,16 @@ function getExtendedFollows(callback, k, maxDepth = 3, currentDepth = 1) {
|
|||||||
|
|
||||||
addFollow(k, currentDepth - 1);
|
addFollow(k, currentDepth - 1);
|
||||||
|
|
||||||
|
let n = 0;
|
||||||
State.public.user(k).get('follow').map().on((isFollowing, followedKey) => { // TODO: unfollow
|
State.public.user(k).get('follow').map().on((isFollowing, followedKey) => { // TODO: unfollow
|
||||||
if (follows[followedKey] === isFollowing) { return; }
|
if (follows[followedKey] === isFollowing) { return; }
|
||||||
if (isFollowing) {
|
if (isFollowing) {
|
||||||
|
n = n + 1;
|
||||||
addFollow(followedKey, currentDepth, k);
|
addFollow(followedKey, currentDepth, k);
|
||||||
if (currentDepth < maxDepth) {
|
if (currentDepth < maxDepth) {
|
||||||
|
setTimeout(() => {
|
||||||
getExtendedFollows(callback, followedKey, maxDepth, currentDepth + 1);
|
getExtendedFollows(callback, followedKey, maxDepth, currentDepth + 1);
|
||||||
|
}, n * 100);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
removeFollow(followedKey, currentDepth, k);
|
removeFollow(followedKey, currentDepth, k);
|
||||||
|
Loading…
Reference in New Issue
Block a user