cursor = Mongo::Cursor.new('log.accesses', selector: {'log_time' => {'$gt' => processed_time}}, timeout: false, tailable: true, order: [['$natural', 1]]) loop do break if cursor.closed? begin document = cursor.next_document unless document then sleep(0.1) next end <ϖʔδϏϡʔίϨΫγϣϯͷߋ৽ॲཧ> if document["log_time"] > processed_time then processed_time = log_time Tmp::PagePosition.update_processed_time(processed_time) end rescue => e <Τϥʔग़ྗ> cursor.close break end end end