Giter Site home page Giter Site logo

resque_solo's People

Contributors

andreynering avatar donnoman avatar teeparham avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

resque_solo's Issues

Jobs aren't being queued

When Resque::Plugins::UniqueJob is included in my job class, the job doesn't get queued at all. Initially I thought this was a potential conflict with Resque Retry, but I've removed that for testing purposes and the jobs still don't get queued.

I'm using Resque in conjunction with the following plugins:

gem 'resque_solo'
gem 'resque-pool'
gem 'resque-retry'
gem 'resque-scheduler'
gem 'resque-web'
gem 'resque-scheduler-web'

My job looks like this:

class AgentCheckJob
  include Resque::Plugins::UniqueJob

  @queue = :check

  # Given an Agent id, load the Agent, call #check on it, and then save it with an updated `last_check_at` timestamp.
  def self.perform(agent_id)
    agent = Agent.find_by(id: agent_id)
    return unless agent

    begin
      return if agent.unavailable?
      agent.log "Checking: #{agent.name}"

      agent.check
      agent.last_check_at = Time.now
      agent.save!

      agent.log "Done: #{agent.name}"
    rescue => e
      agent.error "Exception during check. #{e.message}: #{e.backtrace.join("\n")}"
      raise
    end
  end
end

Gem not working through `perform_later` due to ActiveJob's ResqueAdapter overriding klass with JobWrapper?

Hey!

Suppose we have a class MyJob, inheriting from ApplicationJob:

class MyJob < ApplicationJob
  include Resque::Plugins::UniqueJob
  ...
  ...
  def perform(object_id)
    ..
  end
end

By doing:

Resque.enqueue MyJob, object_id

we bypass the middle things happening inside ActiveJob framework and we call directly Resque.enqueue, which has been overriden by this gem, so the work of scheduling unique jobs is done fine.

However, when scheduling a background job through the common perform_later

MyJob.perform_later(object_id)

then this goes through ActiveJob framework, which will be utilizing the corresponding ResqueAdapter, which in turn triggers Resque.enqueue but with klass set to JobWrapper
https://github.com/rails/rails/blob/main/activejob/lib/active_job/queue_adapters/resque_adapter.rb#L31-L34

To my understanding, this unfortunately makes then the is_unique? check done by this gem to be always failing because that JobWrapper class will not have the ::Resque::Plugins::UniqueJob included, thus not adhering to create unique jobs.

def is_unique?(item)
const_for(item).included_modules.include?(::Resque::Plugins::UniqueJob)
rescue NameError
false
end

Do I miss something obvious?
If yes, what?
If not, are there any suggestions to overcome this?

Thanks a lot in advance!

Using resque-scheduler 4.0.0 does not create key resque:solo

Hi!

I'am using resque-solo and resque-scheduler (4.0.0) with its "cronfile"

I've noticed that the jobs are running in parallel. I expected that using resque-solo, resque-scheduler could not enqueue a job that was already running.

I was monitoring redis and I've noticed that the key resque:solo:queue... is only being deleted, I couldn't see any command to create/set this key

Am I doing something wrong?

$ redis-cli monitor | grep solo

1448909636.770702 "del" "resque:solo:queue:worker_x:job:86fd876d33242629e92bdd69d81f8626"
1448909651.239846 "del" "resque:solo:queue:worker_x:job:c0ab5f17e0801db8b2501ffa915a9c5c"
1448909667.033185 "del" "resque:solo:queue:worker_x:job:caca80022e5baf00fa450005b7dc534e"
1448909739.145888 "del" "resque:solo:queue:worker_x:job:55f4dd3bd601860526db1ac51125fa51"
1448909789.734518 "del" "resque:solo:queue:worker_x:job:958a6669df3e81f9227e990a588d2780

resque_solo does not play well with scheduled jobs

Hi,

I am using https://github.com/wanelo/counter-cache to schedule counting jobs that get enqueued automatically after a few actions. Unfortunately counter-cache is not smart in the sense that it doesn't detect if a job is already in the queue, hence why I started using resque_solo which works perfectly for "immediate" counting jobs, it does not work with schedule ones.

As you can see:

screen shot 2016-11-15 at 11 11 25 am

some of these jobs have the same signature and same timestamp. I'd argue that jobs with the same timestamp and signature should not be in the queue at the same time, correct?

Thank you

#enqueued? ... when being worked on?

Is it possible that enqueued? only returns true when a job is waiting in the queue? And then, when a worker picks it up, it returns false? It looks like you query redis, but i'm not familiar with the resque protocol.

I'm trying to find out if a job is in the queue OR is being worked on. In the process, so to speak.

Resque 1.26 support?

Would this be possible? Do we know if Resque 1.26 introduces any incompatibilities?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.