job is running but sidekiq queue is empty
<p>I am trying to figure out how I can access the status of the background job using sidekiq.</p>

<p>To check the status of the job I check the size of the queue.</p>

<pre><code>class PagesWorker
    include Sidekiq::Worker
    include Sidekiq::Status::Worker

    sidekiq_options queue: "high"

    def perform(ifile)
        system "rake db:..."

        # What do the following do? In what scenario would I need to set these?
        total 100
        at 5, "Almost done"
        store vino: 'veritas'
        vino = retrieve :vino
    end
end

class PagesController
    def submit
        job_id = SomeWorker.perform_async(file)
        flash[:notice] = "#{job_id} is being processed."
    end

    def finished
        queue = Sidekiq::Status.new('high')
        if queue.size == 0
           flash[:success] = "Job is finished."
        elsif queue.size &gt; 0
           flash[:notice] = "Job is being processed."
        end
    end
end
</code></pre>

<p>It prints "Job is finished" from the start (while the job is still running) because the queue is always zero. Specifically, in myrailsapp/sidekiq page I see the following:</p>

<ul>
<li>The number of processed jobs increments by one every time I submit a job, which is correct.</li>
<li>The 'high' queue is there but its size is always 0, which isn't correct.</li>
<li>And there are no jobs listed under the queue, which again isn't correct.</li>
</ul>

<p>However the job is being processed and finishes successfully. Could the reason for the job not appearing in the sidekiq page be that the job finishes in less that a minute? Or maybe because the worker runs a rake process?</p>

<p>I have also checked the following in the terminal, while the process is running:</p>

<pre><code>Sidekiq::Status::complete? job_id #returns false
Sidekiq::Status::status(job_id) #returns nothing
Sidekiq::Status::get_all job_id #returns {"update_time"=&gt;"1458063970", "total"=&gt;"100", "at"=&gt;"5", "message"=&gt;"Almost done"}, and after a while returns {}
</code></pre>

<p>To sum up, my queue is empty, my jobs list is empty, but my job is running. How is this possible? What can I do to track the status of my job?</p>

<p><strong>EDIT</strong></p>

<p>I use the job status to check whether it is finished or not.</p>

<p>Controller:</p>

<pre><code>def finished
    job_id = params[:job_id]
    if Sidekiq::Status::complete? job_id == true
       flash[:notice] = "Job is finished."
    elsif Sidekiq::Status::complete? job_id == false
       flash[:notice] = "Job is being processed."
    end
end
</code></pre>

<p>Form:</p>

<pre><code>=form_tag({action: :submit},multipart: true) do # submit is my controller method as defined above
    = file_field_tag 'file'
    = submit_tag 'submit'

=flash[:notice] # defined above as "#{job_id} is being processed."
-job_id = flash[:notice].split(" ")[0]
=form_tag({action: :finished}) do
    = hidden_field_tag 'job_id', job_id
    = submit_tag 'check'
</code></pre>

<p>Routes:</p>

<pre><code> resources :pages do
     collection do
        post 'submit' 
        post 'finished'
     end
 end
</code></pre>

<p>But the Sidekiq::Status::complete? job_id never turns to true. I am tailing the log file to see when the process will finish, and click on the check button but still get that it is still getting processed. Why?</p>