Skip to content

rpc: Add caching support (backport #9650)#222

Merged
jmalicevic merged 6 commits intov0.37.xfrom
mergify/bp/v0.37.x/pr-9650
Jan 27, 2023
Merged

rpc: Add caching support (backport #9650)#222
jmalicevic merged 6 commits intov0.37.xfrom
mergify/bp/v0.37.x/pr-9650

Conversation

@jmalicevic
Copy link
Collaborator

This is a backport of tendermint/tendermint#9650

thanethomson and others added 4 commits November 3, 2022 17:20
* Set cache control in the HTTP-RPC response header

* Add a simply cache policy to the RPC routes

* add a condition to check the RPC request has default height settings

* fix cherry pick error

* update pending log

* use options struct intead of single parameter

* refacor FuncOptions to functional options

* add functional options in WebSocket RPC function

* revert doc

* replace deprecated function call

* revise functional options

* remove unuse comment

* fix revised error

* adjust cache-control settings

* Update rpc/jsonrpc/server/http_json_handler.go

Co-authored-by: Thane Thomson <connect@thanethomson.com>

* linter: Fix false positive

Signed-off-by: Thane Thomson <connect@thanethomson.com>

* rpc: Separate cacheable and non-cacheable HTTP response writers

Allows us to roll this change out in a non-API-breaking way, since this
is an additive change.

Signed-off-by: Thane Thomson <connect@thanethomson.com>

* rpc: Ensure consistent caching strategy

Ensure a consistent caching strategy across both JSONRPC- and URI-based
requests.

This requires a bit of a refactor of the previous caching logic, which
is complicated a little by the complex reflection-based approach taken
in the Tendermint RPC.

Signed-off-by: Thane Thomson <connect@thanethomson.com>

* rpc: Add more tests for caching

Signed-off-by: Thane Thomson <connect@thanethomson.com>

* Update CHANGELOG_PENDING

Signed-off-by: Thane Thomson <connect@thanethomson.com>

* light: Sync routes config with RPC core

Signed-off-by: Thane Thomson <connect@thanethomson.com>

* rpc: Update OpenAPI docs

Signed-off-by: Thane Thomson <connect@thanethomson.com>

Signed-off-by: Thane Thomson <connect@thanethomson.com>
Co-authored-by: jayt106 <jaytseng106@gmail.com>
Co-authored-by: jay tseng <jay.tseng@crypto.com>
Co-authored-by: JayT106 <JayT106@users.noreply.github.com>
(cherry picked from commit 816c6ba)

# Conflicts:
#	CHANGELOG_PENDING.md
#	test/fuzz/tests/rpc_jsonrpc_server_test.go
Signed-off-by: Thane Thomson <connect@thanethomson.com>
@jmalicevic jmalicevic added the rpc label Jan 27, 2023
@jmalicevic jmalicevic requested a review from a team as a code owner January 27, 2023 09:43
@jmalicevic jmalicevic merged commit 8d9efff into v0.37.x Jan 27, 2023
@jmalicevic jmalicevic deleted the mergify/bp/v0.37.x/pr-9650 branch January 27, 2023 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants