Skip to content

Commit

Permalink
fix(mu): make prevSortKey also optional to allow undefined. Add loggi…
Browse files Browse the repository at this point in the history
…ng on message endpoint
  • Loading branch information
TillaTheHun0 committed Oct 24, 2023
1 parent 5c34af0 commit 428df60
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
2 changes: 1 addition & 1 deletion servers/mu/src/domain/lib/processMsg/cache-and-write-tx.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const ctxSchema = z.object({
id: z.string(),
sortKey: z.string(),
timestamp: z.number(),
prevSortKey: z.string().nullable()
prevSortKey: z.string().nullable().optional()
})
}).passthrough()

Expand Down
14 changes: 10 additions & 4 deletions servers/mu/src/routes/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,17 @@ export const withMessageRoutes = (app) => {
*/
of({ raw: body })
.chain(initMsgs)
.map(res => ({ msgs: res.msgs, spawns: res.spawns }))
.chain(crankMsgs)
.bimap(
logger.tap('Failed to crank messages'),
logger.tap('Successfully cranked messages')
logger.tap('Failed to forward initial message to the SU and read result from the CU'),
logger.tap('Successfully forwarded initial message to the SU and read result from the CU. Beginning to crank...')
)
.map(res => ({ msgs: res.msgs, spawns: res.spawns }))
.chain(res =>
crankMsgs(res)
.bimap(
logger.tap('Failed to crank messages'),
logger.tap('Successfully cranked messages')
)
)
.toPromise()

Expand Down

0 comments on commit 428df60

Please sign in to comment.