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

NoMethodError: undefined method `gsub' for nil:NilClass #280

Open
lagoan opened this issue Dec 15, 2022 · 0 comments
Open

NoMethodError: undefined method `gsub' for nil:NilClass #280

lagoan opened this issue Dec 15, 2022 · 0 comments

Comments

@lagoan
Copy link
Contributor

lagoan commented Dec 15, 2022

We are getting nil values when waiting for the next item from the preservation queue. We are specifically checking for this case where the result is nil so it is odd that we are still having this problem.

2022-12-15 04:23 | chard.library.ualberta.ca | undefined method `gsub' for nil:NilClass
2022-12-14 04:28 | chard.library.ualberta.ca | undefined method `gsub' for nil:NilClass
2022-12-13 04:25 | chard.library.ualberta.ca | undefined method `gsub' for nil:NilClass
2022-12-12 17:07 | chard.library.ualberta.ca | undefined method `gsub' for nil:NilClass
2022-12-12 04:59 | chard.library.ualberta.ca | undefined method `gsub' for nil:NilClass
2022-12-11 04:44 | chard.library.ualberta.ca | undefined method `gsub' for nil:NilClass
2022-12-10 04:24 | chard.library.ualberta.ca | undefined method `gsub' for nil:NilClass
2022-12-09 10:43 | chard.library.ualberta.ca | undefined method `gsub' for nil:NilClass
2022-12-09 10:13 | chard.library.ualberta.ca | undefined method `gsub' for nil:NilClass
2022-12-09 10:00 | chard.library.ualberta.ca | undefined method `gsub' for nil:NilClass
2022-12-09 09:57 | chard.library.ualberta.ca | undefined method `gsub' for nil:NilClass
2022-12-09 09:44 | chard.library.ualberta.ca | undefined method `gsub' for nil:NilClass
2022-12-09 09:40 | chard.library.ualberta.ca | undefined method `gsub' for nil:NilClass

The offending code is here:

def run_preservation_cycle
entity_json = queue.wait_next_item
# jupiter is submitting the entries to reddis in a hash format using fat arrows. We need to change them to colons in
# order to parse them correctly from json
entity = JSON.parse(entity_json.gsub('=>', ':'), { symbolize_names: true })
return unless entity[:type].present? && entity[:uuid].present?

@lagoan lagoan mentioned this issue Jun 24, 2024
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

No branches or pull requests

1 participant