Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble with "inline" mode #243

Closed
kevinmtrowbridge opened this issue Sep 8, 2017 · 1 comment
Closed

Trouble with "inline" mode #243

kevinmtrowbridge opened this issue Sep 8, 2017 · 1 comment
Milestone

Comments

@kevinmtrowbridge
Copy link

kevinmtrowbridge commented Sep 8, 2017

Hi! Thanks for your gem! It's very useful.

When I integrated sidekiq-unique-jobs, we started seeing Sidekiq no longer respecting the inline mode. It would try to call out to Redis, despite Sidekiq::Testing.inline! having been enabled.

I hunted around and eventually found this code snippet in your Gitter chat room:

  # https://gitter.im/mhenrixon/sidekiq-unique-jobs?at=579288da32bd01d843a4e2e8
  module SidekiqUniqueJobs
    module Lock
      class UntilExecuted
        def lock(scope)
          if scope.to_sym != :client
            raise ArgumentError, "#{scope} middleware can't #{__method__} #{unique_key}"
          end

          logger.debug { "faked lock #{unique_key} for #{max_lock_time} seconds" }
          true
        end
      end
    end

    module Unlockable
      def unlock_by_key(unique_key, jid, redis_pool = nil)
        logger.debug "faked unlock for #{unique_key}"
        true
      end
    end
  end

In the chat room "Mika Hel @mhenrixon" goes on to say:

Mika Hel @mhenrixon Jul 25 2016 01:29
@dorkusprime, @wagenet your issues should be mostly resolved in the newest version of the gem. Released yesterday evening

... I am using version 5.0.10 -- which is the latest version released, however, I still have to include that monkey patch. Is the fix definitely included in the gem? What am I doing wrong?

Thanks,
Kevin

@mhenrixon
Copy link
Owner

The problem is multifold. Some people would like their unique checks in inline and fake modes. Personally I'd like to avoid the custom mock_redis to test uniqueness in fake and inline modes.

It would be tremendously more simple to just allow jobs in sidekiq test mode to be sent to wherever rather than use locking for testing. In my opinion it should be enough to just allow jobs when sidekiq is running in test mode and if someone truly wants to run tests against the real thing they would be using the uniqueness checks.

It is hard to make that decision at the moment but maybe I will reconsider. Doesn't seem fair to test uniqueness in fake and inline modes anyway.

@mhenrixon mhenrixon added this to the Version 6.0 milestone Jun 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants