Permalink
Browse files

better default and cleanup only on config change and use the right cl…

…ass for comparision
  • Loading branch information...
mkristian committed Nov 4, 2011
1 parent 5cf8677 commit be8ad81de1e910a4d5f025d49152ce998ad3ed0e
Showing with 4 additions and 3 deletions.
  1. +4 −3 lib/ixtlan/errors/error_dumper.rb
@@ -27,12 +27,13 @@ class ErrorDumper
attr_accessor :from_email, :to_emails, :keep_dumps, :base_url
def initialize
- @keep_dumps = 0
+ @keep_dumps = 30
end
def keep_dumps=(ttl)
+ old = @keep_dumps
@keep_dumps = ttl.to_i
- daily_cleanup
+ daily_cleanup if old != @keep_dumps
end
def error_dump_model(model = nil)
@@ -85,7 +86,7 @@ def dump_hashmap(map, indent = '')
def daily_cleanup
if(@last_cleanup.nil? || @last_cleanup < 1.days.ago)
- @last_cleanup = Date.today
+ @last_cleanup = 0.days.ago # to have the right type
begin
delete_all
logger.info("cleaned error dumps")

0 comments on commit be8ad81

Please sign in to comment.