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

NameError in error handling when trying to run background job #2821

Closed
hading opened this issue Sep 22, 2022 · 1 comment
Closed

NameError in error handling when trying to run background job #2821

hading opened this issue Sep 22, 2022 · 1 comment
Assignees

Comments

@hading
Copy link

hading commented Sep 22, 2022

Expected Behavior

We have a background job or somesuch which is attempting to run and hitting the exception handling in the get_next_job method in https://github.com/archivesspace/archivesspace/blob/v3.2.0/backend/app/lib/background_job_queue.rb, specifically the Sequel::NoExistingObject Branch

Current Behavior

The code raises an exception, but the exception handling code itself is buggy and fails.

Possible Solution

The problem is that the 'job' variable is lexically restricted to the block and not available to the exception handler. A simple but kludgey fix would be to have a variable initially defined outside the block and assigned the value of job inside which would then be visible to the handlers. One could probably also move the begin block and handlers inside the block, although then if you want it to bail out on the first failure it'd take a little work to replicate that behavior.

Steps to Reproduce (for bugs)

I'm not sure why our code is getting into this in the first place, so I don't know, but if you hit this rescue clause you'll get the error.

Your Environment

ASpace 3.2.0, though the bug is still in the 3.3.0 code.

@quoideneuf quoideneuf self-assigned this Nov 28, 2022
quoideneuf pushed a commit to quoideneuf/archivesspace that referenced this issue Nov 28, 2022
@quoideneuf
Copy link
Collaborator

Thanks! 👍

quoideneuf pushed a commit to quoideneuf/archivesspace that referenced this issue Nov 28, 2022
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

2 participants