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

Convert 'retry' to string for ES compatibility #5

Merged
merged 6 commits into from
Aug 23, 2018

Conversation

matus-vacula
Copy link
Contributor

'retry' field can contain not just integer but also false. This breaks ES compatibility.

The error I'm currently getting:

failed to parse [retry]
Current token (VALUE_FALSE) not numeric, can not use numeric value accessors

Copy link

@vitorreis vitorreis left a comment

Choose a reason for hiding this comment

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

The fix is appreciated

@matus-vacula
Copy link
Contributor Author

@iMacTia please check

@iMacTia
Copy link
Owner

iMacTia commented Apr 9, 2018

Hi @matus-vacula, retry should always be a boolean, while retry_count is a number.
Can you show me an example of retry being a number and from which log that comes from?
I can't just accept this PR and merge it, as it will break others ES setup

@matus-vacula
Copy link
Contributor Author

Hi @iMacTia, as mentioned in https://github.com/mperham/sidekiq/blob/master/lib/sidekiq/job_retry.rb#L26 it can contain an integer too.

@iMacTia
Copy link
Owner

iMacTia commented Apr 9, 2018

I see, that makes sense then.
It seems to be the case when you specify a max number of retries per job.
I'd then suggest we do a type check on retry and, if Integer, we add it to the payload at a separate voice. Something like:

if payload['retry'].is_a?(Integer)
  payload['max_retries'] = payload['retry']
  payload['retry'] = true
end

This way backwards compatibility should be preserved.
Would this work for you?

@matus-vacula
Copy link
Contributor Author

Works for me.

@matus-vacula
Copy link
Contributor Author

@iMacTia updated

@iMacTia
Copy link
Owner

iMacTia commented Apr 9, 2018

Thanks @matus-vacula, looks good to me, I'd just like another maintainer to have a look as I'm not currently using this in production, but they are.
I've added him as a reviewer, if he's happy with the change as well, I'll get it merged and release a new version

@iMacTia iMacTia requested a review from silviusimeria April 9, 2018 16:30
@matus-vacula
Copy link
Contributor Author

I stumbled upon another case where delivery to ES was broken. unique_args can have the same problem as args

Matus Vacula added 2 commits April 10, 2018 11:01
@iMacTia
Copy link
Owner

iMacTia commented Apr 10, 2018

@matus-vacula I think unique_args is not a standard Sidekiq field.
Are you using sidekiq-unique-jobs?

If that's the case, then probably all fields injected by that gem are currently not supported.
I'd suggest to keep this PR simple and only fix the retry which is a standard Sidekiq property.

Support for sidekiq-unique-jobs should be addressed separately upon further investigation on a separate PR

This reverts commit 1245be1.
@matus-vacula
Copy link
Contributor Author

sure, no problem

Copy link
Owner

@iMacTia iMacTia left a comment

Choose a reason for hiding this comment

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

Looks good to me, if good for @silviusimeria as well we can merge it 👍

@iMacTia iMacTia requested a review from PaulaCara May 3, 2018 09:32
@silviusimeria
Copy link
Collaborator

@iMacTia sorry, I have just noticed this, I will have a look

Copy link
Collaborator

@silviusimeria silviusimeria left a comment

Choose a reason for hiding this comment

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

Looks good to me

@iMacTia iMacTia merged commit 99691d0 into iMacTia:master Aug 23, 2018
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.

5 participants