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 runAt property to job #146

Merged
merged 1 commit into from
Aug 13, 2018
Merged

Conversation

bp-FLN
Copy link
Contributor

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

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.

@coveralls
Copy link

coveralls commented Aug 5, 2018

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
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
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
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
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

*
* @param jedis
* @param queueName
* @param jobOffset
* @param jobCount
* @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
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
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
Copy link
Owner

gresrun commented Aug 13, 2018

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

@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