Timer opa服务器超时

Timer opa服务器超时,timer,timeout,opa,Timer,Timeout,Opa,我有以下错误: Error: uncaught OPA exception {OpaRPC_Server: {timeout: {client: {client: $"j98soqx7hbavgq2scg915j7mlkctdeop"$; page: $1 042254815$}; fun_id: $"_v0_get_value_stdlib.core.xhtml"$}}} 使用下面的简单代码: function start() { content = <textarea styl

我有以下错误:

Error: uncaught OPA exception {OpaRPC_Server: {timeout: {client: {client: $"j98soqx7hbavgq2scg915j7mlkctdeop"$; page: $1
042254815$}; fun_id: $"_v0_get_value_stdlib.core.xhtml"$}}}
使用下面的简单代码:

function start()
{

  content = <textarea style="width:30%;" rows=1 id=#text > text </textarea> <+>
  <div id=#copy></div>
  Scheduler.timer(3000, function() {#copy =+ Dom.get_value(#text)})
  content
}


Server.start(
  Server.http,
  { page:start,
    title:"bug timer"
  }
)
函数开始()
{
内容=文本
timer(3000,function(){#copy=+Dom.get#u value(#text)})
内容
}
Server.start(
Server.http,
{第页:开始,
标题:“错误计时器”
}
)
当我关闭运行应用程序的选项卡时,会出现此错误。虽然选项卡已关闭,但计时器似乎仍在继续工作

我怎样才能阻止它

谢谢


kayhman

您有几种解决问题的方法。第一种方法是在调度函数启动异常时显式停止计时器。这给了一些类似的东西:

function start()
{
   content = <textarea style="width:30%;" rows=1 id=#text > text </textarea> <+>
   <div id=#copy></div>
   recursive timer = 
     Scheduler.make_timer(3000, function() {
       @catch(function(exn){Log.error("EXN", "{exn}"); timer.stop()},
              #copy =+ Dom.get_value(#text))
       }
     )
   content
}
2-启动在onready事件中,当div#copy就绪时,计时器将启动

function start()
{
  content = <textarea style="width:30%;" rows=1 id=#text > text </textarea> <+>
  <div id=#copy onready={function(_){
    Scheduler.timer(3000, function() {#copy =+ Dom.get_value(#text)})
  }}
  ></div>
  Scheduler.timer(3000, function() {#copy =+ Dom.get_value(#text)})
  content
函数开始()
{
内容=文本
timer(3000,function(){#copy=+Dom.get#u value(#text)})
内容
}

function start()
{
  content = <textarea style="width:30%;" rows=1 id=#text > text </textarea> <+>
  <div id=#copy onready={function(_){
    Scheduler.timer(3000, function() {#copy =+ Dom.get_value(#text)})
  }}
  ></div>
  Scheduler.timer(3000, function() {#copy =+ Dom.get_value(#text)})
  content