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

feature: views | queues & stats #2

Merged
merged 3 commits into from Apr 14, 2017
Merged

feature: views | queues & stats #2

merged 3 commits into from Apr 14, 2017

Conversation

2can
Copy link
Collaborator

@2can 2can commented Apr 13, 2017

download

download

download 1

@2can 2can requested a review from zaiste April 13, 2017 22:40
let busy = await Job.activeSize();
let sizes = await Queue.sizes(await Queue.all());
let queued = Object.keys(sizes).reduce((acc, queue) => {
return acc += sizes[queue];
Copy link
Owner

Choose a reason for hiding this comment

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

@2can implicit return

async function dashboard(ctx, next) {
await ctx.render('index', {});
let done = await Job.processedSize();
Copy link
Owner

Choose a reason for hiding this comment

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

@2can group it with Promise.all

let done = await Job.processedSize();
let failed = await Job.failedSize();
let busy = await Job.activeSize();
let sizes = await Queue.sizes(await Queue.all());
Copy link
Owner

Choose a reason for hiding this comment

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

@2can let's make sizes to return by default the size for all queues, no additional call

lib/queue.js Outdated
@@ -38,15 +38,23 @@ class Queue extends EventEmitter {
return `blezer:queues:${this.name}`
}

get jobs() {
static jobs() {
Copy link
Owner

Choose a reason for hiding this comment

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

@2can this cannot be static, cf this below

lib/queue.js Outdated
return redis.lrangeAsync(this.path, 0, -1);
}

get size() {
return redis.llenAsync(this.path);
static size(name = 'default') {
Copy link
Owner

Choose a reason for hiding this comment

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

@2can it'd be more coherent to not use it as static

lib/queue.js Outdated
static get all() {
static async sizes(names = ['default']) {
let sizes = {};
for (const name of names) {
Copy link
Owner

Choose a reason for hiding this comment

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

@2can 2can force-pushed the feature-views branch 2 times, most recently from 8189723 to bd225b4 Compare April 14, 2017 16:04
@2can 2can changed the title WIP feature: views | queues & stats feature: views | queues & stats Apr 14, 2017
@2can
Copy link
Collaborator Author

2can commented Apr 14, 2017

@zaiste done

@zaiste zaiste merged commit 4324399 into master Apr 14, 2017
@zaiste zaiste deleted the feature-views branch April 14, 2017 17:24
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.

None yet

2 participants