Skip to content

Commit b44112e

Browse files
committed
fix(mu): make su response page size config
1 parent 1003ff8 commit b44112e

File tree

4 files changed

+12
-5
lines changed

4 files changed

+12
-5
lines changed

servers/cu/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ There are a few environment variables that you can set. Besides
149149
to be retrieved from the dryrun cache.
150150
- `DRY_RUN_PROCESS_CACHE_TTL`: the TTL of the dryrun process memory cache.
151151
If a eval stream is more nonces behind than this limit, a 503 is returned.
152+
- `LOAD_MESSAGES_PAGE_SIZE`: the size of the page to load when fetching messages from the AO SU.
152153

153154
## Tests
154155

servers/cu/src/bootstrap.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ export const createApis = async (ctx) => {
365365
loadMessages: AoSuClient.loadMessagesWith({
366366
hashChain: (...args) => hashChainWorker.exec('hashChain', args),
367367
fetch: ctx.fetch,
368-
pageSize: 1000,
368+
pageSize: ctx.LOAD_MESSAGES_PAGE_SIZE || 1000,
369369
logger
370370
}),
371371
loadProcessLatest: AoSuClient.loadProcessLatestWith({ fetch: ctx.fetch, logger }),
@@ -457,7 +457,7 @@ export const createApis = async (ctx) => {
457457
loadMessages: AoSuClient.loadMessagesWith({
458458
hashChain: (...args) => hashChainWorker.exec('hashChain', args),
459459
fetch: ctx.fetch,
460-
pageSize: 1000,
460+
pageSize: ctx.LOAD_MESSAGES_PAGE_SIZE || 1000,
461461
logger
462462
}),
463463
loadProcessLatest: AoSuClient.loadProcessLatestWith({ fetch: ctx.fetch, logger }),

servers/cu/src/config.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,8 @@ const CONFIG_ENVS = {
181181
IGNORE_LOCAL_CHECKPOINTS: process.env.IGNORE_LOCAL_CHECKPOINTS === 'true',
182182
HYDRATION_MODE_NONCE_LIMIT: process.env.HYDRATION_MODE_NONCE_LIMIT || 200,
183183
DRY_RUN_DEFAULT_MAX_PROCESS_AGE: process.env.DRY_RUN_DEFAULT_MAX_PROCESS_AGE || 100,
184-
DRY_RUN_PROCESS_CACHE_TTL: process.env.DRY_RUN_PROCESS_CACHE_TTL || 2000
184+
DRY_RUN_PROCESS_CACHE_TTL: process.env.DRY_RUN_PROCESS_CACHE_TTL || 2000,
185+
LOAD_MESSAGES_PAGE_SIZE: process.env.LOAD_MESSAGES_PAGE_SIZE || 1000
185186
},
186187
production: {
187188
MODE,
@@ -242,7 +243,8 @@ const CONFIG_ENVS = {
242243
IGNORE_LOCAL_CHECKPOINTS: process.env.IGNORE_LOCAL_CHECKPOINTS === 'true',
243244
HYDRATION_MODE_NONCE_LIMIT: process.env.HYDRATION_MODE_NONCE_LIMIT || 200,
244245
DRY_RUN_DEFAULT_MAX_PROCESS_AGE: process.env.DRY_RUN_DEFAULT_MAX_PROCESS_AGE || 100,
245-
DRY_RUN_PROCESS_CACHE_TTL: process.env.DRY_RUN_PROCESS_CACHE_TTL || 2000
246+
DRY_RUN_PROCESS_CACHE_TTL: process.env.DRY_RUN_PROCESS_CACHE_TTL || 2000,
247+
LOAD_MESSAGES_PAGE_SIZE: process.env.LOAD_MESSAGES_PAGE_SIZE || 1000
246248
}
247249
}
248250

servers/cu/src/domain/model.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,11 @@ export const domainConfigSchema = z.object({
262262
/**
263263
* The TTL of the dry run process cache in milliseconds.
264264
*/
265-
DRY_RUN_PROCESS_CACHE_TTL: positiveIntSchema
265+
DRY_RUN_PROCESS_CACHE_TTL: positiveIntSchema,
266+
/**
267+
* The size of the page to load when fetching messages from the AO SU.
268+
*/
269+
LOAD_MESSAGES_PAGE_SIZE: positiveIntSchema
266270
})
267271

268272
export const bufferSchema = z.any().refine(buffer => {

0 commit comments

Comments
 (0)