Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Work fe1 ljankoschek data exchange fix #1978

Closed
wants to merge 6 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,24 @@ const LinkedOrganizationsScreen = () => {
useEffect(() => {
const fetchData = async (linkedOrgId: Hash) => {
const channel = channelFromIds(linkedOrgId);
await subscribeToChannel(linkedOrgId, dispatch, channel);
await catchup(channel);
// sometimes there are erros without the extra waiting time - temporary fix
await new Promise((f) => setTimeout(f, 1000));
setLinkedLaoId(linkedOrgId);
let counter = 0;
const subscribeAndCatchup = async (): Promise<void> => {
try {
await subscribeToChannel(linkedOrgId, dispatch, channel);
await catchup(channel);
await new Promise((resolve) => setTimeout(resolve, 2000));
setLinkedLaoId(linkedOrgId);
} catch (error) {
console.log(error);
if (counter >= 10) {
return;
}
counter += 1;
await new Promise((resolve) => setTimeout(resolve, 5000)); // wait before retrying
await subscribeAndCatchup(); // retry by calling the function recursively
}
};
await subscribeAndCatchup();
};
if (
recvChallengeState &&
Expand Down
Loading