Perl mojolicious需要所有的超时时间来加载hypnotoad制作页面
在我的mojolicous项目中有一个页面可以正确加载,但是连接直到到达超时时间才完成 我只是在生产服务器上遇到了hypnotoad的问题 我无法复制开发方面的问题 有一天,我一直在调查这个问题,因为页面正在处理一个外部服务的api请求 起初我认为这是由于一些Mojo::UserAgent问题造成的,我一直在尝试Promise和IOLoop的多种组合,所有人都在工作 简化代码为:Perl mojolicious需要所有的超时时间来加载hypnotoad制作页面,perl,mojolicious,Perl,Mojolicious,在我的mojolicous项目中有一个页面可以正确加载,但是连接直到到达超时时间才完成 我只是在生产服务器上遇到了hypnotoad的问题 我无法复制开发方面的问题 有一天,我一直在调查这个问题,因为页面正在处理一个外部服务的api请求 起初我认为这是由于一些Mojo::UserAgent问题造成的,我一直在尝试Promise和IOLoop的多种组合,所有人都在工作 简化代码为: sub show { my $s = shift; my $customer = Model::C
sub show {
my $s = shift;
my $customer = Model::Customers->new();
$customer->id( $s->session('id') );
$customer->get();
my $subscription = Model::Customers::Subscriptions->new();
$subscription->id( $s->session('id') );
$subscription->get();
my $plan = Model::Plans->new();
$plan->id( $subscription->idPlan );
$plan->get;
$s->stash(
namePlan => $plan->name,
monthDuration => $plan->monthDuration,
amount => $plan->amount,
end => $subscription->end,
status => $subscription->status,
signupDate => $customer->signupDate,
endTrial => $customer->endTrial,
diffTrial => $customer->diffTrial,
trialDays => $customer->trialDays,
startSubscription => $subscription->start,
discount => $plan->discount,
newsletter => $newsletter,
);
$s->render();
}
我不共享模板代码,因为它不是必需的
页面和模板加载正确,但浏览器chrome会一直加载,直到到达超时。(15秒默认值)问题的原因是我使用了一个保留的隐藏字“status” 解决方案是更改隐藏和模板中变量的名称:
$s->stash(
namePlan => $plan->name,
monthDuration => $plan->monthDuration,
amount => $plan->amount,
end => $subscription->end,
subStatus => $subscription->status,
signupDate => $customer->signupDate,
endTrial => $customer->endTrial,
diffTrial => $customer->diffTrial,
trialDays => $customer->trialDays,
startSubscription => $subscription->start,
discount => $plan->discount,
newsletter => $newsletter,
);
为供参考,此处记录了保留的存储值:相关: