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

Reduce RQ status load time #4257

Merged
merged 2 commits into from
Oct 23, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 2 additions & 3 deletions client/app/pages/admin/Jobs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,9 @@ class Jobs extends React.Component {
}

processQueues = ({ queues, workers }) => {
const queueCounters = values(queues).map(({ name, started, queued }) => ({
name,
const queueCounters = values(queues).map(({ started, ...rest }) => ({
started: started.length,
queued: queued.length,
...rest,
}));

const overallCounters = queueCounters.reduce(
Expand Down
2 changes: 1 addition & 1 deletion redash/monitor.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def rq_queues():
q.name: {
'name': q.name,
'started': fetch_jobs(q, StartedJobRegistry(queue=q).get_job_ids()),
'queued': fetch_jobs(q, q.job_ids)
'queued': len(q.job_ids)
Copy link
Member

Choose a reason for hiding this comment

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

Does q.job_ids include queued and started?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

RQ does an LPOP when it starts executing a job so q.job_ids won't include started ones (instead, they are moved to rq:wip:..., which is observed by the StartedJobRegistry).

} for q in Queue.all(connection=redis_connection)}


Expand Down