Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add _queue-status endpoint to realm server #2070

Merged
merged 3 commits into from
Jan 28, 2025
Merged

Conversation

lukemelia
Copy link
Contributor

No description provided.

@lukemelia lukemelia requested a review from a team January 21, 2025 20:05
Copy link

github-actions bot commented Jan 21, 2025

Host Test Results

    1 files  ±  0      1 suites  ±0   22m 50s ⏱️ +55s
743 tests +50  741 ✔️ +49  2 💤 +2  0 ±0 
748 runs  +51  746 ✔️ +51  2 💤 +2  0  - 1 

Results for commit a36644b. ± Comparison against base commit 316d35f.

This pull request removes 1 and adds 51 tests. Note that renamed tests count towards both.
Chrome ‑ error
Chrome 132.0 ‑ Acceptance | AI Assistant tests: attaches a card in a conversation multiple times
Chrome 132.0 ‑ Acceptance | AI Assistant tests: displays active LLM in chat input
Chrome 132.0 ‑ Acceptance | Freestyle: smoke check
Chrome 132.0 ‑ Acceptance | code submode | file-tree tests > when the user lacks write permissions: it is reflected in the realm header
Chrome 132.0 ‑ Acceptance | code submode | file-tree tests: can navigate file tree, file view mode is persisted in query parameter
Chrome 132.0 ‑ Acceptance | code submode | file-tree tests: can open files
Chrome 132.0 ‑ Acceptance | code submode | file-tree tests: can open files in base realm
Chrome 132.0 ‑ Acceptance | code submode | file-tree tests: can scroll to bottom of the file tree
Chrome 132.0 ‑ Acceptance | code submode | file-tree tests: navigating to a file in a different realm causes it to become active in the file tree
Chrome 132.0 ‑ Acceptance | code submode | file-tree tests: open directories are persisted
…

♻️ This comment has been updated with latest results.

Comment on lines 9 to 33
return async function (ctxt: Koa.Context, _next: Koa.Next) {
let [{ pending_job_count }] = (await query(dbAdapter, [
`SELECT COUNT(*) as pending_job_count FROM jobs WHERE status='unfulfilled'`,
])) as {
pending_job_count: string;
}[];
return setContextResponse(
ctxt,
new Response(
JSON.stringify({
data: {
type: 'queue-status',
id: 'queue-status',
attributes: {
pending: parseInt(pending_job_count, 10),
},
},
}),
{
headers: { 'content-type': SupportedMimeType.JSONAPI },
},
),
);
};
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is it ok that this is an unprotected route? perhaps we should have a shared secret to access this? otherwise a malicious client might try to DDoS our DB impacting the system overall.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In our previous projects we had a x-data-integrity-checks-authorization header was used to authorize requests of this type. Perhaps we could have something similar here, depending on the service that will consume this

@lukemelia lukemelia requested a review from jurgenwerk January 27, 2025 20:43
@lukemelia lukemelia force-pushed the queue-depth-endpoint branch from c686323 to a36644b Compare January 27, 2025 21:53
Copy link
Contributor

@jurgenwerk jurgenwerk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@lukemelia lukemelia merged commit 86a2a24 into main Jan 28, 2025
51 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants