From af6dd257ccf0338d72cd35dc15e67ace10257231 Mon Sep 17 00:00:00 2001 From: Godfrain Jacques Date: Thu, 21 Mar 2024 16:49:34 -0700 Subject: [PATCH] (fix/desktop) fix sporadic empty community token hodler list (#14057) This PR fixes #13650 - Reduces the timer for fetching the token hodlers to refresh cashe - Check for temporary contract address before making requests --- src/app_service/service/community_tokens/service.nim | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/app_service/service/community_tokens/service.nim b/src/app_service/service/community_tokens/service.nim index de9829a0d3..ed9d451fbd 100644 --- a/src/app_service/service/community_tokens/service.nim +++ b/src/app_service/service/community_tokens/service.nim @@ -323,7 +323,7 @@ QtObject: result.communityService = communityService result.currencyService = currencyService result.tokenOwnersTimer = newQTimer() - result.tokenOwnersTimer.setInterval(10*60*1000) + result.tokenOwnersTimer.setInterval(5*60*1000) signalConnect(result.tokenOwnersTimer, "timeout()", result, "onRefreshTransferableTokenOwners()", 2) result.tokenOwners1SecTimer = newQTimer() result.tokenOwners1SecTimer.setInterval(1000) @@ -1369,7 +1369,13 @@ QtObject: dataToEmit.requestId = responseJson{"requestId"}.getStr self.events.emit(SIGNAL_COMPUTE_AIRDROP_FEE, dataToEmit) + proc isTokenDeployed(self: Service, token: CommunityTokenDto): bool = + return token.deployState == DeployState.Deployed + proc fetchCommunityOwners*(self: Service, communityToken: CommunityTokenDto) = + if not self.isTokenDeployed(communityToken): + return + if communityToken.tokenType == TokenType.ERC20: let arg = FetchAssetOwnersArg( tptr: cast[ByteAddress](fetchAssetOwnersTaskArg), @@ -1392,6 +1398,8 @@ QtObject: ) self.threadpool.start(arg) return + else: + debug "Unable to fetch token hodlers for token type ", token=communityToken.tokenType proc onCommunityTokenOwnersFetched*(self:Service, response: string) {.slot.} = let responseJson = response.parseJson()