Backgroundrb

hi,

i want to upload and convert video using backgroundrb.

In my case everything is fine, but i dont understand why my controller
is waiting for worker to be done?

if i use this method
success = system("#{FFMPEG} -i #{video_file} -s 320x240 -ar 22050
{video_file}.flv")
my controller is waiting for worker to be done.

but if i use this method
success = IO.popen(“ffmpeg -i #{video_file} -ab 32k -ar 22050 -s 320x240
#{video_file}.flv”)

controller dont waiting for worker.

But then i dont have any feedback about converting status.

Can someone explain me what im doing wrong or how can i do best ?

thank you

sergej

seems my controller is waiting worker to be done, whatever action it
does.

my controller look like this:

session[:job_key] = MiddleMan.new_worker(:worker =>
:upload_handler_worker, :job_key => @multimedia_ad.id.to_s)

MiddleMan.send_request(:worker => :upload_handler_worker, :worker_method
=> :upload_video, :data => @multimedia_ad.id, :job_key =>
session[:job_key])

what am i doing wrong?

sine serz wrote:

hi,

i want to upload and convert video using backgroundrb.

In my case everything is fine, but i dont understand why my controller
is waiting for worker to be done?

if i use this method
success = system("#{FFMPEG} -i #{video_file} -s 320x240 -ar 22050
{video_file}.flv")
my controller is waiting for worker to be done.

but if i use this method
success = IO.popen(“ffmpeg -i #{video_file} -ab 32k -ar 22050 -s 320x240
#{video_file}.flv”)

controller dont waiting for worker.

But then i dont have any feedback about converting status.

Can someone explain me what im doing wrong or how can i do best ?

thank you

sergej

Probably not the source of your problem but I can tell you are not using
the newest version of backgroundrb by your syntax. The new version goes
from this

MiddleMan.send_request(:worker => :upload_handler_worker, :worker_method
=> :upload_video, :data => @multimedia_ad.id, :job_key =>
session[:job_key])

to:

MiddleMan.worker(:upload_handler_worker,
session[:job_key]).upload_video(@multimedia_ad.id)

In my opinion, a far superior syntax.

Thanks Hemant,

It is working now.

On Tue, Mar 25, 2008 at 6:10 PM, Nathan E.
[email protected] wrote:

Probably not the source of your problem but I can tell you are not using
the newest version of backgroundrb by your syntax. The new version goes
from this

MiddleMan.send_request(:worker => :upload_handler_worker, :worker_method
=> :upload_video, :data => @multimedia_ad.id, :job_key =>
session[:job_key])

When you are using send_request to send task to worker, you are asking
that I will wait for results back no matter how much time it takes.
You shouldn’t use send_request, its blocking in nature. You should
rather use ask_work

to:

MiddleMan.worker(:upload_handler_worker,
session[:job_key]).upload_video(@multimedia_ad.id)

In my opinion, a far superior syntax.

100%, above method is also non blocking in nature, so you can use it
too!


Posted via http://www.ruby-forum.com/.


Let them talk of their oriental summer climes of everlasting
conservatories; give me the privilege of making my own summer with my
own coals.

http://gnufied.org