Skip to content

Commit

Permalink
⚗️ Test without erpc memory storage
Browse files Browse the repository at this point in the history
  • Loading branch information
KONFeature committed Dec 19, 2024
1 parent 6e907c5 commit dbdd344
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 52 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ on:
push:
branches:
- main
- erpc-experiment
- staging

concurrency:
Expand Down Expand Up @@ -48,7 +49,7 @@ jobs:
- name: "🔧 Set up environment variables"
run: |
if [ "${{ github.ref }}" == "refs/heads/main" ]; then
if [ "${{ github.ref }}" == "refs/heads/main" ] || [ "${{ github.ref }}" == "refs/heads/erpc-experiment" ]; then
echo "STAGE=production" >> $GITHUB_ENV
echo "PONDER_PROD_IMAGE_TAG=${{ github.sha }}" >> $GITHUB_ENV
echo "PONDER_DEV_IMAGE_TAG=latest" >> $GITHUB_ENV
Expand Down Expand Up @@ -126,7 +127,7 @@ jobs:
- name: "🚀 SST Deploy"
run: |
bun sst install
if [ "${{ github.ref }}" == "refs/heads/main" ]; then
if [ "${{ github.ref }}" == "refs/heads/main" ] || [ "${{ github.ref }}" == "refs/heads/erpc-experiment" ]; then
bun run deploy:prod
else
bun run deploy:dev
Expand Down
97 changes: 47 additions & 50 deletions packages/erpc/src/storage.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
import {
type CacheConfig,
CacheEmptyBehaviorAllow,
CacheEmptyBehaviorIgnore,
type CachePolicyConfig,
type ConnectorConfig,
DataFinalityStateFinalized,
DataFinalityStateRealtime,
DataFinalityStateUnfinalized,
} from "@erpc-cloud/config";

if (!process.env.ERPC_DATABASE_URL) {
Expand All @@ -25,22 +22,22 @@ const connectors = [
table: "rpc_cache",
},
},
{
id: "memory-unfinalized",
driver: "memory",
memory: {
// max 4k items for unfinalized cache
maxItems: 4_096,
},
},
{
id: "memory-realtime",
driver: "memory",
memory: {
// Max 4k items for realtime cache
maxItems: 4_096,
},
},
// {
// id: "memory-unfinalized",
// driver: "memory",
// memory: {
// // max 4k items for unfinalized cache
// maxItems: 4_096,
// },
// },
// {
// id: "memory-realtime",
// driver: "memory",
// memory: {
// // Max 4k items for realtime cache
// maxItems: 4_096,
// },
// },
] as const satisfies ConnectorConfig[];

/**
Expand All @@ -57,37 +54,37 @@ const cachePolicies = [
finality: DataFinalityStateFinalized,
empty: CacheEmptyBehaviorAllow,
},
// Cache not finalized data for 2sec in the memory
{
connector: "memory-unfinalized",
network: "*",
method: "*",
finality: DataFinalityStateUnfinalized,
empty: CacheEmptyBehaviorIgnore,
// 2sec in nanoseconds
ttl: 2_000_000_000,
maxItemSize: "20kb",
},
// Cache realtime data for 2sec on the memory on arbitrum
{
connector: "memory-realtime",
network: "evm:42161",
method: "*",
finality: DataFinalityStateRealtime,
empty: CacheEmptyBehaviorIgnore,
// 2sec in nanoseconds
ttl: 2_000_000_000,
},
// Cache realtime data for 30sec on arbitrum sepolia
{
connector: "memory-realtime",
network: "evm:421614",
method: "*",
finality: DataFinalityStateRealtime,
empty: CacheEmptyBehaviorIgnore,
// 30sec in nanoseconds
ttl: 30_000_000_000,
},
// // Cache not finalized data for 2sec in the memory
// {
// connector: "memory-unfinalized",
// network: "*",
// method: "*",
// finality: DataFinalityStateUnfinalized,
// empty: CacheEmptyBehaviorIgnore,
// // 2sec in nanoseconds
// ttl: 2_000_000_000,
// maxItemSize: "20kb",
// },
// // Cache realtime data for 2sec on the memory on arbitrum
// {
// connector: "memory-realtime",
// network: "evm:42161",
// method: "*",
// finality: DataFinalityStateRealtime,
// empty: CacheEmptyBehaviorIgnore,
// // 2sec in nanoseconds
// ttl: 2_000_000_000,
// },
// // Cache realtime data for 30sec on arbitrum sepolia
// {
// connector: "memory-realtime",
// network: "evm:421614",
// method: "*",
// finality: DataFinalityStateRealtime,
// empty: CacheEmptyBehaviorIgnore,
// // 30sec in nanoseconds
// ttl: 30_000_000_000,
// },
] as const satisfies CachePolicyConfig[];

/**
Expand Down

0 comments on commit dbdd344

Please sign in to comment.