Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable function input size #792

Merged
merged 5 commits into from
Jan 20, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ MIRROR_NODE_RETRIES =
MIRROR_NODE_RETRY_DELAY =
GAS_PRICE_TINY_BAR_BUFFER =
MIRROR_NODE_LIMIT_PARAM =
CLIENT_TRANSPORT_SECURITY=
CLIENT_TRANSPORT_SECURITY=
INPUT_SIZE_LIMIT=
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@ GAS_PRICE_TINY_BAR_BUFFER = 10000000000
MIRROR_NODE_RETRIES = 3
MIRROR_NODE_RETRY_DELAY = 500
MIRROR_NODE_LIMIT_PARAM = 100
INPUT_SIZE_LIMIT = 1
```

Note: Read more about `DEV_MODE` [here](docs/dev-mode.md)
Expand Down
1 change: 1 addition & 0 deletions helm-chart/templates/configmap.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,4 @@ data:
MIRROR_NODE_RETRIES: {{ .Values.config.MIRROR_NODE_RETRIES | quote }}
MIRROR_NODE_RETRY_DELAY: {{ .Values.config.MIRROR_NODE_RETRY_DELAY | quote }}
MIRROR_NODE_LIMIT_PARAM: {{ .Values.config.MIRROR_NODE_LIMIT_PARAM | quote }}
INPUT_SIZE_LIMIT: {{ .Values.config.INPUT_SIZE_LIMIT | quote }}
1 change: 1 addition & 0 deletions helm-chart/value-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ config:
MIRROR_NODE_RETRIES: 3
MIRROR_NODE_RETRY_DELAY: 500
MIRROR_NODE_LIMIT_PARAM: 100
INPUT_SIZE_LIMIT: 1

# Enable rolling_restarts if SDK calls fail this is usually due to stale connections that get cycled on restart
rolling_restart:
Expand Down
1 change: 1 addition & 0 deletions helm-chart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ config:
MIRROR_NODE_RETRY_DELAY: 500
MIRROR_NODE_LIMIT_PARAM: 100
CLIENT_TRANSPORT_SECURITY: false
INPUT_SIZE_LIMIT: 1

# Enable rolling_restarts if SDK calls fail this is usually due to stale connections that get cycled on restart
rolling_restart:
Expand Down
3 changes: 2 additions & 1 deletion packages/server/src/koaJsonRpc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,8 @@ export default class KoaJsonRpc {

constructor(logger: Logger, register: Registry, opts?) {
this.koaApp = new Koa();
this.limit = '1mb';
const limit = process.env.INPUT_SIZE_LIMIT || 1;
this.limit = limit + 'mb';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kind of weird that this.limit can be overwritten if you send in opts and it has a limit below in line 62. We should probably only use one potential mechanism for setting this configuration value.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I agree with @lukelee-sl

this.duration = parseInt(process.env.LIMIT_DURATION!) || 60000;
this.registry = Object.create(null);
this.registryTotal = Object.create(null);
Expand Down
1 change: 1 addition & 0 deletions packages/server/tests/localAcceptance.env
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,4 @@ MIRROR_NODE_RETRIES = 3
MIRROR_NODE_RETRY_DELAY = 500
GAS_PRICE_TINY_BAR_BUFFER = 10000000000
MIRROR_NODE_LIMIT_PARAM = 2
INPUT_SIZE_LIMIT=1