php-resque-scheduler and resque-web interface URI::InvalidURIError at /delayed

555 views Asked by At

I am using Chris Boulton's php port of resque (php-resque) and resque-scheduler (php-resque-scheduler), I am also using the standard resque-web interface to view jobs / queues etc.

I have not had any issues with resque-web until I recently installed resque-scheduler and setup a config for resque-web as per the instructions here.

Using php-resque-scheduler I don't have any issues (it seems) scheduling my queues to be delayed, however when I login to resque-web and click the "delayed" tab I get the following error:

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

I only get this error once a job has been set to be delayed.

My feeling is that the namespace of the PHP class is breaking something with the resque-web routing. I'm a bit stumped as I'm not massively familiar with Ruby and not keen on editing package files etc.

I am running ruby 1.9.1, on Ubuntu Trusty 14.04 if that helps. Doing resque-web -v gives me:

rack 1.2

sinatra 1.4.5

vegas 0.1.11

Any help on this one would be much appreciated!

UPDATE: I tried aliasing the class for the job and passing the aliased class through and that does not break the interface, so I think my original assumption as correct. It's not really a solution but is workable.

2

There are 2 answers

0
kevbaldwyn On BEST ANSWER

My solution was to alias the class in php and pass the alias to the job:

class_alias('My\NameSpaced\Class', 'My_NameSpaced\Class');
0
Kai On

I have this problem too, the reason is resque-web try to get the URI of class name, but your 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.

I'm not familiar with Ruby/Rails, I just try to integrate resque to php, so I just need the web monitor to watch my queue/jobs status

So here is my workaround to fix this problem, just for reference, I know this is not 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