insomniacslk / irc-slack

IRC-to-Slack gateway
BSD 3-Clause "New" or "Revised" License
195 stars 19 forks source link

Speed up joining large teams #160

Closed insomniacslk closed 3 years ago

insomniacslk commented 3 years ago

This change speeds up joining large teams. Comparatively, on my laptop, joining the Gophers slack team (~65k users) the time goes down from ~3m15s to ~1m45s.

This has been achieved by fetching users upon joining channels, and using a cache, rather than fetching all the users at once upfront.

There are other opportunities for further speed-ups which can be tackled separately, e.g. calling Users.FetchByIDs in a goroutine while channel users are fetched rather than at the end, see the usersInConversation function.

Signed-off-by: Andrea Barberio insomniac@slackware.it

codecov[bot] commented 3 years ago

Codecov Report

Merging #160 (a7d888f) into master (165c22a) will decrease coverage by 0.20%. The diff coverage is 0.00%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master    #160      +/-   ##
=========================================
- Coverage    9.97%   9.76%   -0.21%     
=========================================
  Files           9       9              
  Lines        1003    1024      +21     
=========================================
  Hits          100     100              
- Misses        899     920      +21     
  Partials        4       4              
Flag Coverage Δ
unittest 9.76% <0.00%> (-0.21%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pkg/ircslack/irc_server.go 0.00% <0.00%> (ø)
pkg/ircslack/users.go 55.55% <0.00%> (-21.37%) :arrow_down:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 165c22a...a7d888f. Read the comment docs.