(ctx context.Context, username, network, address string)
| 79 | } |
| 80 | |
| 81 | func (j *JSLimitProvider) Parameters(ctx context.Context, username, network, address string) (res *LimitParameters, err error) { |
| 82 | defer func() { |
| 83 | if err != nil { |
| 84 | j.logger.Error("%v", err) |
| 85 | } |
| 86 | }() |
| 87 | req, _ := dto.FilterParamsFromContext(ctx) |
| 88 | ri := jsext.JSRequestInfoFromRequest(req) |
| 89 | di, err := jsext.JSDstInfoFromContext(ctx, network, address) |
| 90 | if err != nil { |
| 91 | return nil, fmt.Errorf("unable to construct dst info: %w", err) |
| 92 | } |
| 93 | func() { |
| 94 | f := <-j.funcPool |
| 95 | defer func(pool chan JSLimitFunc, f JSLimitFunc) { |
| 96 | pool <- f |
| 97 | }(j.funcPool, f) |
| 98 | res, err = f(ri, di, username) |
| 99 | }() |
| 100 | if err != nil { |
| 101 | return nil, fmt.Errorf("JS limit script exception: %w", err) |
| 102 | } |
| 103 | if res == nil { |
| 104 | return nil, fmt.Errorf("JS limit script returned null object") |
| 105 | } |
| 106 | return res, nil |
| 107 | } |
nothing calls this directly
no test coverage detected