Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8744483
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:50:50+00:00 2026-06-13T11:50:50+00:00

I am using Resque to process some background jobs on a Rails application. The

  • 0

I am using Resque to process some background jobs on a Rails application.

The thing is that clients can cancel this jobs, so:

  • If the job is still on the queue: dequeue it

    Resque.dequeue(GitHub::Jobs::UpdateNetworkGraph, 'repo:135325')
    
  • If the job has finished: do nothing

  • If the job is running: ???

Is there a way to programmatically find the job and in case it is running tell it to stop immediatly? My main concern is to be sure that I kill the desired job, not the current one being processed as it could be a different one form the moment I ask if it is running until the moment I kill it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:50:51+00:00Added an answer on June 13, 2026 at 11:50 am

    I dont think that resque store the process id of the fork process, it does
    log it though but I dont it store the process id of the child process forked

    you can see over here in Line 139

    With regard to your question of how extract the process id of the running resque job I think the way to do it inside your job itself using redis data-structure

    so consider code below is your perform action for a job create using redis hash(running_process) and add the current process_id in it with the current timestamp

    class MyJob
     @queue = :myjob
    
     def self.perform
       field = Time.now.to_i
       redis.hsetnx "running_process",field,Process.pid 
       ### Rest of the code
    
    
    
       #### when the code is about to finish 
       ##remove the finish process from the 
       redis.hdel "running_process",field
      end
    

    Now you can get the list of all running process by simply querying redis “running_process” hash something like this

    redis.hgetall "running_process"

    Caveats over here If the resque job fail then the process id would never be clean’t from

    the hash what ever you do just make sure you cross check the process id you collect

    from the redis hash is actually a running resque job

    Hope this help

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an application that does some image processing using rmagick and imagemagick. This
I have a ruby on rails app using the resque gem to process background
I'm using Resque on a rails-3 project to handle jobs that are scheduled to
I'm using resque/redis on heroku to send emails as a background job. It works
I am using rails 3 with devise for authentication and resque for handling background
Im using Resque + RedisToGo for my background jobs. I am having trouble running
trying to work past an issue when using a resque job to process inbound
We are interested in using a background job queue such as resque, backgroundjob or
I am currently using Resque for my background process but recently I heard a
I am using a resque gem to process my background process. I have setup

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.