⚠ Switch to EXCALIDRAW VIEW in the MORE OPTIONS menu of this document. ⚠ You can decompress Drawing data with the command palette: ‘Decompress current Excalidraw file’. For more info check in plugin settings under ‘Saving’
Excalidraw Data
Text Elements
Resilience interceptor — calling batch_get_code_using_cache()
(Inbound) batch_distribute_voucher | v (Transport) GAS / Spex | | cmd: voucher.ss.distribution.batch_distribute_voucher v (Generated Spex dispatcher) _Distribution_BatchDistributeVoucherHandler(ctx, req, resp) → DistributionServer.service.BatchDistributeVoucher(ctx, req, resp) v (Handler entry) BatchDistributeVoucherImpl.Execute(ctx, req, resp) → validateBatchReq(req.GetRequests()) → distributeService.BatchDistribute(ctx, region, infos) v (Distribute orchestration) Service.BatchDistribute(ctx, region, infos) - steps := [checkRateLimitAvailability, checkUserExistence, loadVouchers, …, loadCodes, …] - meta, err := ExecuteSteps(ctx, meta, steps) v (Step: loadCodes) loadCodes(meta)(ctx) - identifiers := extractCompleteVoucherIdentifiers(meta) - codeMap, err := s.CodeService.BatchGetMap(ctx, meta.region, identifiers) | v code.Service.BatchGetMap(ctx, region, identifiers) - codes, err := s.repo.BatchGetUsingCache(ctx, region, identifiers) | v code.Repo.BatchGetUsingCache(ctx, region, identifiers) - cmd := “voucher.code.batch_get_code_using_cache” - req := getBatchGetCodeUsingCacheRequest(region, identifiers, false) - err := r.client.SpsRPCRequestWithJSONLog(ctx, cmd, req, resp) | v (Outbound Spex client) spex.Client.SpsRPCRequestWithJSONLog(ctx, cmd, req, resp) → c.invokerFunc(ctx, cmd, req, resp) // invokerFunc = chain of ClientInterceptors | v (Resilience interceptor — wraps all outbound Spex calls) resilienceInterceptor.Wrap(invoke)(ctx, cmd, req, resp) - effectiveName := cmd // or shadowName(cmd) if shadow.IsShadow(ctx) - protector, _ := resilience.GetProtector(effectiveName) // keyed by “voucher.code.batch_get_code_using_cache” - if protector == nil → invoke(ctx, cmd, req, resp) - else: blockErr := protector.Protect(ctx, func(ctx context.Context) error { return invoke(ctx, cmd, req, resp, opts…) // circuit breaker / timeout / rate limit }) if blockErr != nil → return convBlockErrToSpexErr(blockErr) return nil | v invoke(ctx, cmd, req, resp) // inner invoker (next interceptor or default Invoker) | v (Actual Spex invocation to downstream) Invoker.Invoke(ctx, “voucher.code.batch_get_code_using_cache”, req, resp) → network / Spex call to voucher.code service → voucher.code.batch_get_code_using_cache