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

我正在使用Chris Boulton的resque(php-resque)和resque-scheduler( php-resque-scheduler ),我也使用标准的resque-web界面来查看作业/队列等。 </ p>

在我最近安装了resque-scheduler并根据说明这里。</ p>

使用php-resque-scheduler我没有 问题(似乎)调度我的队列被延迟,但是当我登录resque-web并单击“延迟”选项卡时,我收到以下错误:</ p>


URI :: InvalidURIError at / delayed
bad URI(不是URI?):/ delayed / jobs / Namespace \ Of \ Job \ Class?args = [%7B%22 </ p>
</ blockquote>
\ n

一旦将作业设置为延迟,我才会收到此错误。</ p>

我的f eeling是PHP类的命名空间破坏了resque-web路由。 我有点难过,因为我不熟悉Ruby并且不热衷于编辑包文件等。</ p>

我在Ubuntu Trusty 14.04上运行ruby 1.9.1,如果这有帮助的话 。 执行 resque-web -v </ code>给我:</ p>


rack 1.2 </ p>

sinatra 1.4.5 < / p>

拉斯维加斯0.1.11 </ p>
</ blockquote>

非常感谢您对此的任何帮助!</ p>

< p>更新:我尝试为作业设置别名,并传递别名类,这不会破坏界面,所以我认为我原来的假设是正确的。 它不是一个真正的解决方案,但是可行。</ p>
</ div>

展开原文

原文

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个回答



我的解决方案是在php中为类别名并将别名传递给作业:</ p>

   class_alias('My \ NameSpaced \ Class','My_NameSpaced \ Class'); 
</ code> </ pre>
</ div>

展开原文

原文

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

class_alias('My\NameSpaced\Class', 'My_NameSpaced\Class');



我也有这个问题,原因是resque-web尝试获取类名的URI,但你的类名有反斜杠, 这是因为PHP命名空间,所以ruby说“Bad URI”,重点是ruby并没有帮助我们逃避</ strong> uri。</ p>

我不是 熟悉Ruby / Rails,我只是尝试将resque集成到php,所以我只需要web监视器来查看我的队列/作业状态</ p>

所以这是解决此问题的解决方法, 仅供参考,我知道这不是最好的方法。</ p>

尝试在gem资源中修改resque-scheduler的视图</ p>

  // 找到你的resque-scheduler gem路径并修改delayed.erb文件
vim~ / .gem / ruby​​ / 2.0 / gems / resque-scheduler-4.0.0 / lib / resque / scheduler / server / views / delayed.erb

//搜索此行
URI(“/ delayed / jobs /#{job ['class']}?args =”

//修改为
URI.escape(“/ delayed / jobs /#{ job ['class']}?args =“
</ code> </ pre>

这就是它</ p>
</ div>

展开原文

原文

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

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问
相关内容推荐