Skip to content

Commit

Permalink
log changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul authored and Paul committed Dec 22, 2010
1 parent de9fd11 commit 0ac9afc
Show file tree
Hide file tree
Showing 7 changed files with 2,346 additions and 14 deletions.
3 changes: 3 additions & 0 deletions Gemfile
Expand Up @@ -5,7 +5,10 @@ gem 'rails', '3.0.3'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

gem 'mongrel', '>= 1.2.0.pre2'
gem 'mongrel_cluster'
gem 'mysql2'
gem 'dispatcher'
gem 'simple-rss'
gem 'tmail'
gem 'test-unit'
Expand Down
12 changes: 12 additions & 0 deletions Gemfile.lock
Expand Up @@ -31,19 +31,28 @@ GEM
addressable (2.2.2)
arel (2.0.6)
builder (2.1.2)
daemons (1.0.10)
dispatcher (0.0.1)
em-http-request (0.2.15)
addressable (>= 2.0.0)
eventmachine (>= 0.12.9)
erubis (2.6.6)
abstract (>= 1.0.0)
eventmachine (0.12.10)
gem_plugin (0.2.3)
i18n (0.5.0)
mail (2.2.12)
activesupport (>= 2.3.6)
i18n (>= 0.4.0)
mime-types (~> 1.16)
treetop (~> 1.4.8)
mime-types (1.16)
mongrel (1.2.0.pre2)
daemons (~> 1.0.10)
gem_plugin (~> 0.2.3)
mongrel_cluster (1.0.5)
gem_plugin (>= 0.2.3)
mongrel (>= 1.0.2)
mysql2 (0.2.6)
polyglot (0.3.1)
rack (1.2.1)
Expand Down Expand Up @@ -77,8 +86,11 @@ PLATFORMS
ruby

DEPENDENCIES
dispatcher
em-http-request
eventmachine
mongrel (>= 1.2.0.pre2)
mongrel_cluster
mysql2
rails (= 3.0.3)
simple-rss
Expand Down
7 changes: 1 addition & 6 deletions app/controllers/entries_controller.rb
Expand Up @@ -83,7 +83,7 @@ def update
render :action => 'edit'
end
end

def destroy
@entry = Entry.find(params[:id])
@entry.destroy
Expand Down Expand Up @@ -136,11 +136,6 @@ def symbol
@entries = Entry.find_all_by_symbol(@symbol,:order=>"sent_at",:conditions=>
["sent_at > ?",DateTime.now - @search_time])

# get the earliest entry, we need to make sure we get a factor for this to fill out the graph
if earliest_graph_item.nil? || (!@entries.nil? && @entries.size() > 0 && earliest_graph_item > @entries[0].sent_at_on_graph)
earliest_graph_item = @entries[0].sent_at_on_graph
end

entries_arr = []
buy_arr = []
sell_arr =[]
Expand Down
5 changes: 4 additions & 1 deletion config/environments/production.rb
Expand Up @@ -19,7 +19,7 @@
# just comment this out and Rails will serve the files

# See everything in the log (default is :info)
# config.log_level = :debug
config.log_level = :debug

# Use a different logger for distributed setups
# config.logger = SyslogLogger.new
Expand All @@ -46,4 +46,7 @@

# Send deprecation notices to registered listeners
config.active_support.deprecation = :notify

puts "environment=production"

end
6 changes: 3 additions & 3 deletions lib/tasks/update.rake
Expand Up @@ -12,7 +12,7 @@ namespace :update do
task :quote => :environment do

# create new updater
Rails.logger.info "START updating quotes"
puts "START updating quotes"
start_time = Time.now

updater = QuoteUpdater.new({})
Expand All @@ -21,8 +21,8 @@ namespace :update do
end_time = Time.now

time_delta = end_time - start_time
Rails.logger.info "Updating quotes took #{time_delta} seconds"
Rails.logger.info "END updating quotes"
puts "Updating quotes took #{time_delta} seconds"
puts "END updating quotes"


end
Expand Down
8 changes: 4 additions & 4 deletions lib/update_quote.rb
Expand Up @@ -27,8 +27,8 @@ def initialize(config)
@queue << entry.symbol
@not_done << entry.symbol
}
Rails.logger.debug "getting quotes for #{@queue.to_yaml}"
Rails.logger.debug "queue size: #{@queue.size}"
puts "getting quotes for #{@queue.to_yaml}"
puts "queue size: #{@queue.size}"
@orig_total = @queue.size
end

Expand Down Expand Up @@ -64,10 +64,10 @@ def start
def finish(symbol,result)
@not_done.delete(symbol)
if @not_done.size < 10
Rails.logger.debug "orig size = #{@orig_total} , left = #{@not_done.to_a.join(",")}"
puts "orig size = #{@orig_total} , left = #{@not_done.to_a.join(",")}"
end
if @not_done.empty?
Rails.logger.debug "stopping EM"
puts "stopping EM"
EventMachine::stop_event_loop
end
end
Expand Down

0 comments on commit 0ac9afc

Please sign in to comment.