1

I have been receiving this error over and over in my resque failed jobs

Errno::ENOENT No such file or directory

I have a background task in my video controller here

def phoneupload
    @video = current_user.videos.build(video_params)
    if @video.save
      Resque.enqueue_at(2.minutes.from_now, MobileUpload, @video.id)
      Resque.enqueue_at(15.minutes.from_now, VideoImageurl, @video.id)
      redirect_to videos_path, notice: 'Video was successfully Posted!'
    else
      render action: 'new'
    end
  end

here is my worker for MobileUpload

class MobileUpload
  @queue = :video_queue
  def self.perform(video_id)
    require 'open-uri'
    require 'net/http/post/multipart'
        require 'json'

    video = Video.find(video_id)

    path_to_video = video.phoneupload.url



      uri = URI('https://upload.wistia.com/')

      http = Net::HTTP.new(uri.host, uri.port)
      http.use_ssl = true

      # Construct the request.
      request = Net::HTTP::Post::Multipart.new uri.request_uri, {
        'api_password' => 'my_secret_api',
        'project_id'   => 'my_proect_id', # Optional.

        'file' => UploadIO.new(
                    File.open(path_to_video),
                    'application/octet-stream',
                    File.basename(path_to_video)
                  )
      }

      # Make it so!
      response = http.request(request)
      result = JSON.parse(response.body)
      hashed_id = result['hashed_id']

      self.update_attribute(:wistiaid, hashed_id)
      save!
  end
end

this line in my worker

path_to_video = video.phoneupload.url

is pulling my uploaded video url that I use paperclip with. The path is being pulled correctly but not working?

4

0 回答 0