Commit 38363d0
fix(communities): fix saving communities is slow because of token fetch
Part of status-im/status-app#20954
I found that saving a big community, like the Status app, for the first time is very slow, averaging 35 seconds.
Turns out the reason is because of the community tokens. The community description handling called the token data fetching in the same thread and in a blocking way. Meaning that nothing was returned until the tokens were fetched. It also means that if the token fetching failed, the whole community saving and signaling would fail.
I moved the token handling in another thread, so that it doesn't slow the main operation. Then, once the fetching and saving is done, we signal again the new community data
(cherry picked from commit 2bee8b6)
(cherry picked from commit 17f1f2f)
(cherry picked from commit 758adcec55c3e4c5c2f4ac571d406a099ad50b26)1 parent 72d3706 commit 38363d0
2 files changed
Lines changed: 53 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2172 | 2172 | | |
2173 | 2173 | | |
2174 | 2174 | | |
2175 | | - | |
2176 | | - | |
2177 | | - | |
2178 | | - | |
2179 | 2175 | | |
2180 | 2176 | | |
2181 | 2177 | | |
| |||
2261 | 2257 | | |
2262 | 2258 | | |
2263 | 2259 | | |
| 2260 | + | |
| 2261 | + | |
| 2262 | + | |
| 2263 | + | |
2264 | 2264 | | |
2265 | 2265 | | |
2266 | 2266 | | |
| |||
4471 | 4471 | | |
4472 | 4472 | | |
4473 | 4473 | | |
| 4474 | + | |
| 4475 | + | |
| 4476 | + | |
| 4477 | + | |
| 4478 | + | |
| 4479 | + | |
| 4480 | + | |
| 4481 | + | |
| 4482 | + | |
| 4483 | + | |
| 4484 | + | |
| 4485 | + | |
| 4486 | + | |
| 4487 | + | |
| 4488 | + | |
| 4489 | + | |
| 4490 | + | |
| 4491 | + | |
| 4492 | + | |
| 4493 | + | |
| 4494 | + | |
| 4495 | + | |
| 4496 | + | |
| 4497 | + | |
| 4498 | + | |
4474 | 4499 | | |
4475 | 4500 | | |
4476 | 4501 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1866 | 1866 | | |
1867 | 1867 | | |
1868 | 1868 | | |
1869 | | - | |
1870 | | - | |
| 1869 | + | |
| 1870 | + | |
| 1871 | + | |
| 1872 | + | |
| 1873 | + | |
| 1874 | + | |
| 1875 | + | |
| 1876 | + | |
| 1877 | + | |
| 1878 | + | |
| 1879 | + | |
| 1880 | + | |
| 1881 | + | |
| 1882 | + | |
1871 | 1883 | | |
1872 | | - | |
1873 | | - | |
1874 | 1884 | | |
1875 | | - | |
1876 | | - | |
| 1885 | + | |
| 1886 | + | |
| 1887 | + | |
| 1888 | + | |
| 1889 | + | |
| 1890 | + | |
| 1891 | + | |
| 1892 | + | |
| 1893 | + | |
| 1894 | + | |
1877 | 1895 | | |
1878 | | - | |
1879 | 1896 | | |
1880 | 1897 | | |
1881 | 1898 | | |
| |||
0 commit comments