(ctx context.Context, userID *ttnpb.UserIdentifiers)
| 276 | } |
| 277 | |
| 278 | func (f *inMemoryCache) UserRights(ctx context.Context, userID *ttnpb.UserIdentifiers) (rights *ttnpb.Rights, err error) { |
| 279 | defer func() { registerRightsRequest(ctx, "user", rights, err) }() |
| 280 | req := newEntityReq(ctx, userID.GetEntityIdentifiers()) |
| 281 | f.mu.Lock() |
| 282 | res := f.userRights[req] |
| 283 | if !res.valid(f.successTTL, f.errorTTL) { |
| 284 | res = newRes() |
| 285 | f.userRights[req] = res |
| 286 | go func() { |
| 287 | res.set(f.Fetcher.UserRights(ctx, userID)) |
| 288 | }() |
| 289 | } |
| 290 | f.maybeCleanup() |
| 291 | f.mu.Unlock() |
| 292 | if err := res.wait(ctx); err != nil { |
| 293 | return nil, err |
| 294 | } |
| 295 | return res.rights, res.err |
| 296 | } |
nothing calls this directly
no test coverage detected