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

Error viewing job with namespace in resque-web #26

Open
kevbaldwyn opened this issue Nov 24, 2014 · 3 comments
Open

Error viewing job with namespace in resque-web #26

kevbaldwyn opened this issue Nov 24, 2014 · 3 comments

Comments

@kevbaldwyn
Copy link

I appreciate this may be an issue with resque-web rather than this package but I wanted to check first if anyone could recreate it...

When I submit a job to be delayed it correctly adds it to redis as I'd expect however when I log into resque web and click the "delayed" tab I get an error:

URI::InvalidURIError at /delayed bad URI(is not URI?): /delayed/jobs/Namespace\Of\Job\Class?args=[%7B%....

It looks to me like an issue with the namespace of the job not being urlsafe...

Has anyone experienced this / resolved it?

p.s amazing work on this suite of packages! I couldn't live without php-resque!

@kaikao
Copy link

kaikao commented Apr 27, 2015

I have this issue too, still thinking how to fix it...

@kevbaldwyn
Copy link
Author

I solved it by creating class aliases to the namespaced classes:

class_alias('\Fully\NameSpaced\Class', 'Fully_NameSpaced_Class');

Then passing the aliased name to the job. Ugly but works.

@kaikao
Copy link

kaikao commented Apr 27, 2015

@kevbaldwyn nice work around!

I've just fixed this earlier, just provide my way to fix:

The reason is resque-web try to get the URI of class name, but the class name has backslash, it's because of PHP namespace, so ruby said "Bad URI", the point is ruby didn't help us to escape the URI, so I think if I can help resque-web to escape URI...?

Then I got my workaround to fix this problem, just for reference, I know this is not may the best way.

Try to modify resque-scheduler's view in gem resource,

// find your resque-scheduler gem path and modify the delayed.erb file
vim ~/.gem/ruby/2.0/gems/resque-scheduler-4.0.0/lib/resque/scheduler/server/views/delayed.erb

// search this line
URI("/delayed/jobs/#{job['class']}?args="

// modify to
URI.escape("/delayed/jobs/#{job['class']}?args="

That's it

my screenshot:

screen shot 2015-04-28 at 12 16 50 am

We can get the fill class name with namespace now :p

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