lib/mizuno/reloader.rb
def reload!(force = false)
            return unless (Time.now.to_i > @threshold)
            @threshold = Time.now.to_i + @interval
            return unless (force or \
                ((timestamp = mtime(@trigger)).to_i > @updated))
            timestamp ||= Time.now.to_i

            # Check updated files to ensure they're loadable.
            missing, errors = 0, 0
            files = find_files_for_reload do |file, file_mtime|
                next(missing += 1 and nil) unless file_mtime
                next unless (file_mtime >= @updated)
                next(errors += 1 and nil) unless verify(file)
                file
            end

            # Cowardly fail if we can't load something.
            @logger.debug("#{missing} files missing during reload.") \
                if (missing > 0)
            return(@logger.error("#{errors} errors, not reloading.")) \
                if (errors > 0)

            # Reload everything that's changed.
            files.each do |file|
                next unless file
                @logger.info("Reloading #{file}")
                load(file) 
            end
            @updated = timestamp
        end
def reload!(force = false)
            return unless (Time.now.to_i > @threshold)
            @threshold = Time.now.to_i + @interval
            return unless (force or \
                ((timestamp = mtime(@trigger)).to_i > @updated))
            timestamp ||= Time.now.to_i

            # Check updated files to ensure they're loadable.
            missing, errors = 0, 0
            files = find_files_for_reload do |file, file_mtime|
                next(missing += 1 and nil) unless file_mtime
                next unless (file_mtime >= @updated)
                next(errors += 1 and nil) unless verify(file)
                file
            end

            # Cowardly fail if we can't load something.
            @logger.debug("#{missing} files missing during reload.") \
                if (missing > 0)
            return(@logger.error("#{errors} errors, not reloading.")) \
                if (errors > 0)

            # Reload everything that's changed.
            files.each do |file|
                next unless file
                @logger.info("Reloading #{file}")
                load(file) 
            end
            @updated = timestamp
        end
def reload! ( force = false ) return unless ( Time . now . to_i > @threshold ) @threshold = Time . now . to_i + @interval return unless ( force or ( ( timestamp = mtime ( @trigger ) ) . to_i > @updated ) ) timestamp ||= Time . now . to_i # Check updated files to ensure they're loadable. missing , errors = 0 , 0 files = find_files_for_reload do | file , file_mtime | next ( missing += 1 and nil ) unless file_mtime next unless ( file_mtime >= @updated ) next ( errors += 1 and nil ) unless verify ( file ) file end # Cowardly fail if we can't load something. @logger . debug ( "#{missing} files missing during reload." ) if ( missing > 0 ) return ( @logger . error ( "#{errors} errors, not reloading." ) ) if ( errors > 0 ) # Reload everything that's changed. files . each do | file | next unless file @logger . info ( "Reloading #{file}" ) load ( file ) end @updated = timestamp end
Reloads the application if (a) we haven't reloaded in
 @interval seconds, (b) the trigger file has been touched
 since our last check, and (c) some other thread hasn't handled
 the update.
Reloads the application if ( a ) we haven t reloaded in