Sha256: 4bf85e2c5c007fea7247776826246b48c1ffa155419997b207a3a7a6589ad6ee
Contents?: true
Size: 685 Bytes
Versions: 5
Compression:
Stored size: 685 Bytes
Contents
module Padrino # High performant source reloader # # This class acts as Rack middleware. # # It is performing a check/reload cycle at the start of every request, but # also respects a cool down time, during which nothing will be done. class Reloader def initialize(app, cooldown = 1, backend = Stat) @app = app @cooldown = cooldown @last = (Time.now - cooldown) end def call(env) if @cooldown and Time.now > @last + @cooldown if Thread.list.size > 1 Thread.exclusive { Padrino.reload! } else Padrino.reload! end @last = Time.now end @app.call(env) end end end
Version data entries
5 entries across 5 versions & 1 rubygems