Skip to content

Commit b6c8fbf

Browse files
authored
1 parent ad5fb5c commit b6c8fbf

3 files changed

Lines changed: 14 additions & 10 deletions

File tree

‎go/avatars/fullcaching.go‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,10 @@ func NewFullCachingSource(g *libkb.GlobalContext, staleThreshold time.Duration,
138138
actor(s.simpleSource.LoadTeams), batcher, reset, 100*time.Millisecond, false,
139139
)
140140
usersStaleBatch, _ := libkb.ThrottleBatch(
141-
actor(s.simpleSource.LoadUsers), batcher, reset, 2000*time.Millisecond, false,
141+
actor(s.simpleSource.LoadUsers), batcher, reset, 5000*time.Millisecond, false,
142142
)
143143
teamsStaleBatch, _ := libkb.ThrottleBatch(
144-
actor(s.simpleSource.LoadTeams), batcher, reset, 2000*time.Millisecond, false,
144+
actor(s.simpleSource.LoadTeams), batcher, reset, 5000*time.Millisecond, false,
145145
)
146146
s.usersMissBatch = usersMissBatch
147147
s.teamsMissBatch = teamsMissBatch

‎go/avatars/interfaces.go‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,22 +9,26 @@ import (
99
"github.com/keybase/client/go/protocol/keybase1"
1010
)
1111

12+
const (
13+
// When changing staleThreshold here, serverside avatar
14+
// `client_avatar_stale_threshold` should be adjusted to match.
15+
staleThreshold = 24 * time.Hour
16+
)
17+
1218
func CreateSourceFromEnvAndInstall(g *libkb.GlobalContext) {
1319
var s libkb.AvatarLoaderSource
1420
typ := g.Env.GetAvatarSource()
1521
switch typ {
1622
case "simple":
1723
s = NewSimpleSource()
1824
case "url":
19-
s = NewURLCachingSource(time.Hour /* staleThreshold */, 20000)
25+
s = NewURLCachingSource(staleThreshold, 20000)
2026
case "full":
2127
maxSize := 10000
2228
if g.IsMobileAppType() {
2329
maxSize = 2000
2430
}
25-
// When changing staleThreshold here, serverside avatar change
26-
// notification dismiss time should be adjusted as well.
27-
s = NewFullCachingSource(g, time.Hour /* staleThreshold */, maxSize)
31+
s = NewFullCachingSource(g, staleThreshold, maxSize)
2832
}
2933
g.AddDbNukeHook(s, fmt.Sprintf("AvatarLoader[%s]", typ))
3034
g.SetAvatarLoader(s)

‎go/service/avatars.go‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,13 @@ func NewAvatarHandler(xp rpc.Transporter, g *libkb.GlobalContext, source libkb.A
3232
var _ keybase1.AvatarsInterface = (*AvatarHandler)(nil)
3333

3434
func (h *AvatarHandler) LoadUserAvatars(ctx context.Context, arg keybase1.LoadUserAvatarsArg) (keybase1.LoadAvatarsRes, error) {
35-
m := libkb.NewMetaContext(ctx, h.G())
36-
return h.source.LoadUsers(m, arg.Names, arg.Formats)
35+
mctx := libkb.NewMetaContext(ctx, h.G()).WithLogTag("UAVTR")
36+
return h.source.LoadUsers(mctx, arg.Names, arg.Formats)
3737
}
3838

3939
func (h *AvatarHandler) LoadTeamAvatars(ctx context.Context, arg keybase1.LoadTeamAvatarsArg) (keybase1.LoadAvatarsRes, error) {
40-
m := libkb.NewMetaContext(ctx, h.G())
41-
return h.source.LoadTeams(m, arg.Names, arg.Formats)
40+
mctx := libkb.NewMetaContext(ctx, h.G()).WithLogTag("TAVTR")
41+
return h.source.LoadTeams(mctx, arg.Names, arg.Formats)
4242
}
4343

4444
const avatarGregorHandlerName = "avatarHandler"

0 commit comments

Comments
 (0)