Skip to content

Commit c03c285

Browse files
author
Alan Shaw
committed
fix: try reducing batch size
1 parent cb8fce6 commit c03c285

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

Diff for: filecoin/functions/metrics-aggregate-offer-and-accept-total.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import * as Sentry from '@sentry/serverless'
2-
import { toString } from 'uint8arrays/to-string'
32
import { fromString } from 'uint8arrays/from-string'
43
import * as DAGJson from '@ipld/dag-json'
54

@@ -64,5 +63,5 @@ export const consumer = Sentry.AWSLambda.wrapHandler(handler)
6463
*/
6564
function parseKinesisEvent (event) {
6665
const batch = event.Records.map(r => fromString(r.kinesis.data, 'base64'))
67-
return batch.map(b => DAGJson.parse(toString(b, 'utf8')))
66+
return batch.map(b => DAGJson.decode(b))
6867
}

Diff for: filecoin/metrics.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ export async function updateAggregateOfferTotal (ucanInvocations, ctx) {
5959
console.log(`${workflowsWithAggregateOffers.size} aggregate offer workflows`)
6060

6161
// From workflows that include aggregate offer receipts, try to get the block with Pieces included in Aggregate
62-
/** @type {AggregateOfferGet[]} */
6362
const aggregateOfferGets = (await Promise.all(
6463
Array.from(workflowsWithAggregateOffers.entries()).map(async ([carCid, aggregateOfferInvocation]) => {
6564
console.log(`getting agent message for task: ${aggregateOfferInvocation.invocationCid}`)
@@ -75,8 +74,7 @@ export async function updateAggregateOfferTotal (ucanInvocations, ctx) {
7574
console.log('update aggregate/offer total for worflow', carCid, aggregateOfferInvocation.invocationCid, 'with pieces', aggregateOfferInvocation.capabilities.map(aggregateOfferCap => aggregateOfferCap.nb.pieces.toString()))
7675
return Promise.all(aggregateOfferInvocation.capabilities.map(aggregateOfferCap => getOfferInfoBlock(aggregateOfferCap, agentMessage.ok)))
7776
})
78-
// @ts-expect-error error types
79-
)).flatMap(get => get)
77+
)).flat()
8078
const aggregateOfferGetError = aggregateOfferGets.find(get => get.error)
8179
if (aggregateOfferGetError) {
8280
throw aggregateOfferGetError.error

Diff for: stacks/filecoin-stack.js

+1
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ export function FilecoinStack({ stack, app }) {
328328
cdk: {
329329
eventSource: {
330330
...(getEventSourceConfig(stack)),
331+
batchSize: 1,
331332
parallelizationFactor: 10
332333
}
333334
}

0 commit comments

Comments
 (0)