Navigation Menu

Skip to content

Commit

Permalink
Recover error from an invalid "date" field
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Jan 15, 2015
1 parent a4a96f7 commit c144df3
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion lib/droonga/engine.rb
Expand Up @@ -130,8 +130,16 @@ def save_last_processed_message_timestamp
def effective_message?(message)
effective_timestamp = effective_message_timestamp
return true if effective_timestamp.nil?
return true unless message["date"]

begin
message_timestamp = Time.parse(message["date"])
rescue ArgumentError => error
logger.error("failed to parse the \"date\" field of a message date",
:message => message)
return false
end

message_timestamp = Time.parse(message["date"])
logger.trace("checking effective_message_timestamp (#{effective_timestamp}) vs message_timestamp(message_timestamp)")
return false if effective_timestamp >= message_timestamp

Expand Down

0 comments on commit c144df3

Please sign in to comment.