Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试使用 sinatra 开发一个 rails metal 端点,但事实证明这很痛苦,因为每次更改代码时我都必须重新启动服务器。我在 Jruby 中并在一个更大的 Java 应用程序中运行。有没有一种简单的方法可以为每个请求刷新此代码?
正因为我喜欢抽象抽象,所以这是 Ryan 的代码 v2:
def every s loop do sleep s yield end end every 1 { `touch tmp/restart.txt` }
我认为没有办法自动重新加载 sinatra 代码,但是:
如果您正在运行乘客,您可以尝试在 irb 中运行:
loop do `touch tmp/restart.txt` sleep(1) end
然后它将告诉乘客实例重新启动应用程序。