【问题标题】:echoprint-codegen runs indefinitely with delayed_jobechoprint-codegen 使用 delay_job 无限期运行
【发布时间】:2013-11-05 01:23:34
【问题描述】:

我正在尝试在后台进程中运行 echoprint-codegen,以便在将音频文件上传到 Web 服务时对其进行分析。

通过对通过回形针上传的 tmp 文件进行简单的系统调用,即可实现所需的功能:

result = `echoprint-codegen #{path} 0 20` # works!

不幸的是,延迟的工人解雇新工作时情况并非如此; echoprint-codegen 进程似乎无限期挂起。

根据echoprint README,我仔细检查了ffmpeg 是否也在路径中(Paperclip.options[:command_path] 指向正确的路径)。

我还尝试将echoprint-codegen 命令行封装在Paperclip.run() 调用中,但这也会导致进程挂起。

任何指针?

【问题讨论】:

    标签: ruby-on-rails paperclip delayed-job system-calls


    【解决方案1】:

    我通过将 echoprint-codegen 系统调用放在 Ruby 线程中获得了所需的功能:

    thread = Thread.new { Thread.current[:result] = `echoprint-codegen #{path} 0 20` }
    thread.join
    result = thread[:result]
    

    【讨论】:

      猜你喜欢
      • 2013-04-08
      • 2012-08-18
      • 1970-01-01
      • 2019-02-04
      • 2023-01-12
      • 2022-06-22
      • 1970-01-01
      • 2017-05-18
      • 1970-01-01
      相关资源
      最近更新 更多