Skip to content

Commit

Permalink
fix(sequences): increase msg limit to 1mio msgs
Browse files Browse the repository at this point in the history
Increase the msg limit used for sequence rest queries
and show a warning if this limit was hit.
This now reflects the same limit as in dlt-logs extension.
  • Loading branch information
mbehr1 committed Jan 7, 2025
1 parent 95325eb commit ff339fd
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/extension/fbaNBRQRenderer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,7 @@ export class FBANBRestQueryRenderer {
): Promise<void> {
try {
const perfStart: number = performance.now()
const maxNrMsgs = 1_000_000
const sequences = JSON5.parse(cell.document.getText())
if (Array.isArray(sequences) && sequences.length > 0) {
// code similar to fba-cli.processSequences (todo refactor to dlt-log-utils/sequences?)
Expand Down Expand Up @@ -706,6 +707,7 @@ export class FBANBRestQueryRenderer {
} else {
// we do want lifecycle infos as well
allFilters[0].addLifecycles = true
allFilters[0].maxNrMsgs = maxNrMsgs + 1 // one more to detect whether we ran into the limit
}
const allFiltersRq: RQ = {
path: 'ext:mbehr1.dlt-logs/get/docs/0/filters?', // todo get from cell data!
Expand Down Expand Up @@ -751,6 +753,10 @@ export class FBANBRestQueryRenderer {
receptionTimeInMs: lifecycle ? lifecycle.lifecycleStart.valueOf() + d.attributes.timeStamp / 10000 : 0,
}
})
const hitMaxNrMsgsLimit = msgs.length > maxNrMsgs
if (hitMaxNrMsgsLimit) {
msgs.splice(maxNrMsgs)
}
const slicedMsgs = msgs.slice(0, 50)
perfNow = performance.now()
perfInterims = perfNow - perfStep
Expand All @@ -771,6 +777,15 @@ export class FBANBRestQueryRenderer {
texts: msgsText,
},
])
if (hitMaxNrMsgsLimit) {
exec.appendOutput(
new NotebookCellOutput([
vscode.NotebookCellOutputItem.stderr(
`Query results were limited to ${maxNrMsgs} messages! Please adjust filters to reduce the amount of messages!`,
),
]),
)
}
perfNow = performance.now()
perfInterims = perfNow - perfStep
perfStep = perfNow
Expand Down

0 comments on commit ff339fd

Please sign in to comment.