Module: Sidekiq::Throttled::QueueName

Defined in:
lib/sidekiq/throttled/queue_name.rb

Overview

Queue name utility belt.

Class Method Summary collapse

Class Method Details

.expand(queue) ⇒ String

Note:

It does not normalizes queue before expanding it, thus double-call of this method will potentially do some harm.

Prepends `queue:` prefix to given `queue` name.



40
41
42
# File 'lib/sidekiq/throttled/queue_name.rb', line 40

def expand(queue)
  "queue:#{queue}"
end

.normalize(queue) ⇒ String

Strips redis-namespace and `queue:` prefix from given queue name.

Examples:


QueueName.normalize "queue:default"
# => "default"

QueueName.normalize "queue:queue:default"
# => "default"

QueueName.normalize "foo:bar:queue:default"
# => "default"


29
30
31
# File 'lib/sidekiq/throttled/queue_name.rb', line 29

def normalize(queue)
  queue.sub(QUEUE_NAME_PREFIX_RE, "")
end