lib/client.rb in navi_client-1.3.8 vs lib/client.rb in navi_client-1.3.9
- old
+ new
@@ -79,12 +79,13 @@
imap.examine folder
message_ids = imap.uid_search(search_condition)
meta_dir = @download_path + 'meta/'
- message_ids_saved = File.directory?(meta_dir) ? (Dir.entries meta_dir).map { |i| i.split("_").first.to_i } : []
+ message_ids_saved = getMessageUUIds(meta_dir)
+
message_ids = message_ids - message_ids_saved
if @debug
if message_ids.empty?
@logger.info "No new emails found..."
@@ -111,11 +112,16 @@
if @mark_as_read
imap.store(message_id, "+FLAGS", [:Seen])
end
end
rescue => e
- logger.info "Issue processing email for uuid ##{message_id}, #{e.message}"
+
+ unless logger.nil?
+ logger.info "Issue processing email for uuid ##{message_id}, #{e.message}"
+ end
+
+ logToLoggly({event:"EMAIL_SYNC_FAILED", env: @env, storage: @client_type, email: @current_user_email, uuid: message_id, error: e.message})
end
end
end
@@ -214,10 +220,10 @@
rescue
true
end
else
- if @debug
+ if @debug && !@logger.nil?
@logger.info "Logging to Loggly disabled"
@logger.info messageBody
end
end