Skip to content

add runAt property to job#146

Merged
gresrun merged 1 commit into
gresrun:masterfrom
uberall:job-runAt-property
Aug 13, 2018
Merged

add runAt property to job#146
gresrun merged 1 commit into
gresrun:masterfrom
uberall:job-runAt-property

Conversation

@bp-FLN

@bp-FLN bp-FLN commented Aug 4, 2018

Copy link
Copy Markdown
Contributor

This patch adds a runAt property to the Job class.
The property is set by QueueInfoDAORedisImpl#getQueueInfo, but only when the queue is a delayed one.
The property is exposed via QueueInfo.getJobs()*.runAt.

@bp-FLN
bp-FLN force-pushed the job-runAt-property branch from f21a108 to cb31baf Compare August 5, 2018 09:09
@coveralls

coveralls commented Aug 5, 2018

Copy link
Copy Markdown

Coverage Status

Coverage increased (+0.06%) to 70.714% when pulling 6b3ef87 on uberall:job-runAt-property into 12884f9 on gresrun:master.

import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.*;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Please only use explicit imports.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

done


class JobPayload {
String element;
Double score;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

These properties can both be final since they're only written to in the constructor.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

i was able to get rid of this, as per your other suggestion

* @return
*/
private Collection<String> paylods(final Jedis jedis, final String queueName, final long jobOffset, final long jobCount) {
private Collection<JobPayload> getJobPayloads(final Jedis jedis, final String queueName, final long jobOffset, final long jobCount) {

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

What if this method just returned Collection<Job>? Since you're iterating over the elements here, might as well create the Job instead of an intermediary JobPayload object. Will simplify getQueueInfo() quite a bit, too.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

yeah totally makes sense and results in less code. thanks!

@gresrun

gresrun commented Aug 13, 2018

Copy link
Copy Markdown
Owner

Thanks for the quality PR! Just a few thoughts on restructuring a bit.

@bp-FLN
bp-FLN force-pushed the job-runAt-property branch from cb31baf to 6b3ef87 Compare August 13, 2018 10:08
@gresrun
gresrun merged commit c0e56a1 into gresrun:master Aug 13, 2018
@bp-FLN
bp-FLN deleted the job-runAt-property branch August 13, 2018 20:21
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.

3 participants