Skip to content

Commit

Permalink
fix(cu): select cached messages with correct seq where clause
Browse files Browse the repository at this point in the history
  • Loading branch information
jfrain99 committed Jan 7, 2025
1 parent 859af1e commit 44fee3b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 6 deletions.
15 changes: 12 additions & 3 deletions servers/cu/src/effects/ao-evaluation.js
Original file line number Diff line number Diff line change
Expand Up @@ -252,14 +252,23 @@ export function findMessageBeforeWith ({ db }) {
FROM ${MESSAGES_TABLE}
WHERE
id = ?
AND "processId" = ?
AND seq < ?
AND processId = ?
AND (
CAST(substr(seq, instr(seq, ':') + 1) as UNSIGNED) < ?
OR
(
CAST(SUBSTR(seq, 1, INSTR(seq, ':') - 1) AS INTEGER) = ?
AND CAST(SUBSTR(seq, INSTR(seq, ':') + 1) AS INTEGER) < ?
)
)
LIMIT 1;
`,
parameters: [
createMessageId({ messageId, deepHash, isAssignment }),
processId,
`${epoch}:${nonce}` // 0:13
epoch,
epoch,
nonce
]
}
}
Expand Down
12 changes: 9 additions & 3 deletions servers/cu/src/effects/ao-evaluation.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -382,7 +382,9 @@ describe('ao-evaluation', () => {
assert.deepStrictEqual(parameters, [
'deepHash-123',
'process-123',
'0:3'
0,
0,
3
])

const mockAssigment = {
Expand Down Expand Up @@ -418,7 +420,9 @@ describe('ao-evaluation', () => {
assert.deepStrictEqual(parameters, [
'message-123',
'process-123',
'0:3'
0,
0,
3
])

const mockAssigment = {
Expand Down Expand Up @@ -453,7 +457,9 @@ describe('ao-evaluation', () => {
assert.deepStrictEqual(parameters, [
'message-123',
'process-123',
'0:3'
0,
0,
3
])

const mockAssigment = {
Expand Down

0 comments on commit 44fee3b

Please sign in to comment.