Sha256: 28a4752aa9d2e185ea3db1c1c7ca7ebc31a959c9c334d0c95303da691a011f38

Contents?: true

Size: 684 Bytes

Versions: 9

Compression:

Stored size: 684 Bytes

Contents

module Bioshogi
  module Formatter
    module Animation
      concern :AnimationBuilderTimeout do
        private

        def tob(name, expires_in = 30, &block)
          begin
            t = Time.now
            logger.info { "[#{name}][begin]" }
            begin
              Timeout::timeout(expires_in, &block)
            rescue Timeout::Error => error
              raise Timeout::Error, "[#{name}] #{error.message}"
            end
          ensure
            t = (Time.now - t).round
            logger.info { "[#{name}][end][#{t}s]" }
          end
        end

        def heavy_tob(name, &block)
          tob(name, 60, &block)
        end
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
bioshogi-0.0.15 lib/bioshogi/formatter/animation/animation_builder_timeout.rb
bioshogi-0.0.14 lib/bioshogi/formatter/animation/animation_builder_timeout.rb
bioshogi-0.0.10 lib/bioshogi/formatter/animation/animation_builder_timeout.rb
bioshogi-0.0.9 lib/bioshogi/formatter/animation/animation_builder_timeout.rb
bioshogi-0.0.8 lib/bioshogi/formatter/animation/animation_builder_timeout.rb
bioshogi-0.0.7 lib/bioshogi/formatter/animation/animation_builder_timeout.rb
bioshogi-0.0.5 lib/bioshogi/formatter/animation/animation_builder_timeout.rb
bioshogi-0.0.4 lib/bioshogi/formatter/animation/animation_builder_timeout.rb
bioshogi-0.0.3 lib/bioshogi/formatter/animation/animation_builder_timeout.rb