Permalink
Browse files

Fix #67 and bump to 2.1.0.1

Signed-off-by: David Celis <me@davidcel.is>
  • Loading branch information...
1 parent 096ae79 commit 172ddd62c5932c8ad1c0e12c38dec4ed81ed015d @davidcelis committed Mar 20, 2013
View
@@ -1,8 +1,15 @@
Changelog
=========
-2.1.0 (Current release)
------------------------
+2.1.0.1 (Current release)
+-------------------------
+
+* Fix #67, a bug with setting the queue name used in the Sidekiq worker.
+ * Deprecate `Recommendable.config.queue_name`.
+* Remove the Rails queueing worker as Rails::Queue has been deprecated
+
+2.1.0
+-----
* Introducing two new configuration options aimed to reduce memory consumed by Redis:
* `furthest_neighbors`: Uses N most dissimilar users when updating recommendations for a user. Similar to `nearest_neighbors`, and can only be used in conjunction with kNN.
* `recommendations_to_store`: the number of recommendations to store in Redis per user. Defaults to 100.
View
@@ -42,11 +42,6 @@ Recommendable.configure do |config|
# Default: true
config.auto_enqueue = true
- # The name of the queue that background jobs will be placed in.
- #
- # Default: recommendable
- config.queue_name = :recommendable
-
# The number of nearest neighbors (k-NN) to check when updating
# recommendations for a user. Set to `nil` if you want to check all
# neighbors as opposed to a subset of the nearest ones. Set this to a lower
@@ -11,7 +11,6 @@
require 'recommendable/workers/resque'
require 'recommendable/workers/delayed_job'
require 'recommendable/workers/torque_box'
-require 'recommendable/workers/rails'
module Recommendable
class << self
@@ -21,11 +21,6 @@ class Configuration
# Default: true
attr_accessor :auto_enqueue
- # The name of the queue that background jobs will be placed in.
- #
- # Default: recommendable
- attr_accessor :queue_name
-
# The number of nearest neighbors (k-NN) to check when updating
# recommendations for a user. Set to `nil` if you want to check all
# neighbors as opposed to a subset of the nearest ones. Set this to a lower
@@ -56,20 +51,29 @@ def initialize
@redis = Redis.new
@redis_namespace = :recommendable
@auto_enqueue = true
- @queue_name = :recommendable
@ratable_classes = []
@nearest_neighbors = nil
@furthest_neihbors = nil
@recommendations_to_store = 100
end
+
+ def queue_name
+ warn "Recommendable.config.queue_name has been deprecated. Jobs will always be placed in a queue named 'recommendable'."
+ end
+
+ def queue_name=(queue_name)
+ warn "Recommendable.config.queue_name has been deprecated. Jobs will always be placed in a queue named 'recommendable'."
+ end
end
class << self
- attr_accessor :config
-
def configure
@config ||= Configuration.new
yield @config
end
+
+ def config
+ @config ||= Configuration.new
+ end
end
end
@@ -2,7 +2,7 @@ module Recommendable
MAJOR = 2
MINOR = 1
PATCH = 0
- PRE = nil
+ PRE = 1
VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join '.'
end
@@ -1,16 +0,0 @@
-module Recommendable
- module Workers
- class Rails
- attr_accessor :user_id
-
- def initialize(user_id)
- @user_id = user_id
- end
-
- def run
- Recommendable::Helpers::Calculations.update_similarities_for(user_id)
- Recommendable::Helpers::Calculations.update_recommendations_for(user_id)
- end
- end
- end
-end
@@ -3,7 +3,7 @@ module Workers
class Sidekiq
if defined?(::Sidekiq)
include ::Sidekiq::Worker
- sidekiq_options :unique => true, :queue => Recommendable.config.queue_name
+ sidekiq_options :unique => true, :queue => :recommendable
end
def perform(user_id)

0 comments on commit 172ddd6

Please sign in to comment.