Skip to content
Browse files

remove re-routing, use n receiver threads instead

  • Loading branch information...
1 parent 24ff9d8 commit 3ae6bd02f002035c039357a04d870fd795d77b52 @svenfuchs svenfuchs committed Mar 5, 2013
Showing with 2 additions and 30 deletions.
  1. +0 −5 Procfile
  2. +2 −25 lib/travis/logs/receive.rb
View
5 Procfile
@@ -1,9 +1,4 @@
logs: ./bin/receive_logs
-logs1: LOGS_QUEUE=1 ./bin/receive_logs
-logs2: LOGS_QUEUE=2 ./bin/receive_logs
-logs3: LOGS_QUEUE=3 ./bin/receive_logs
-logs4: LOGS_QUEUE=4 ./bin/receive_logs
-logs5: LOGS_QUEUE=5 ./bin/receive_logs
aggregate: ./bin/aggregate_logs
archive: bundle exec sidekiq -q archive_past -c 25 -r ./lib/travis/logs/sidekiq/archive.rb
View
27 lib/travis/logs/receive.rb
@@ -27,39 +27,16 @@ def setup
end
def run
- Queue.subscribe(queue_name, &method(:route))
- 0.upto(shards).each do |shard|
- Queue.subscribe(queue_name(shard), &method(:receive))
+ 0.upto(Travis.config.logs.threads || 10).each do
+ Queue.subscribe('logs', &method(:receive))
end
end
private
- def route(payload)
- shard = payload['id'].to_i % shards
- queue = queue_name(shard)
- payload.update(uuid: Travis.uuid)
- Travis::Amqp::Publisher.jobs(queue).publish(payload)
- end
-
def receive(payload)
Travis.run_service(:logs_receive, data: payload)
end
-
- def queue_name(shard = nil)
- name = ['logs']
- name << number if number
- name << ".#{shard}" if shard
- name.join
- end
-
- def shards
- Travis.config.logs.shards - 1
- end
-
- def number
- ENV['LOGS_QUEUE']
- end
end
end
end

0 comments on commit 3ae6bd0

Please sign in to comment.
Something went wrong with that request. Please try again.