我使用Perl Dancer2与基本设置的RESTful服务框架(使用命令如何允许多个连接到Dancer2
dancer2 -a MyWeb即可::应用
生成模板文件并在自动生成的MyWeb-App/lib/MyWeb/App.pm文件中添加“get”路由)。最近我发现,当一个请求需要很长一段时间才能完成,服务器被锁定,只能提供该请求。例如
get '/' => sub {# simple request to redirect to a static page
template 'index'; #template directive Templates all go into the views/
};
get '/compute' => sub{
for (my $i=0;$i<1000000;$i++){
wait(1000); #simulate long computation time
}
return "Done!";
};
当首先在一个选项卡http://myhost.com/compute
进入,在另一个选项卡中的链接http://myhost.com/
不会显示任何东西,直到上一个/计算路线完成,这在我看来,只有一个连接被允许在同一时间。问题是如何设置Dancer2服务器以允许多个连接,即上面提到的两个选项卡可以同时运行?
非常感谢!
请参阅[Dancer :: Deployment](https://metacpan.org/pod/distribution/Dancer/lib/Dancer/Deployment.pod)和[Dancer2 :: Manual :: Deployment](https:// metacpan。组织/ POD /分销/ Dancer2/lib中/ Dancer2 /手动/ Deployment.pod)。 –
非常感谢我在perldancer网站上找不到的链接 – wizardfan