问题:在脚本中调用dpConnect并触发相应的回调函数,运行时在日志中出现大量信息如下:
……
Script: Initialize
, callbackFunc, function has 200 pending runs -> DISCARDING!
分析:在帮助文档中,可以找到如下信息:
The default maximum amount of the queue (events that have to be executed) is 200. As soon as this amount is reached the system discards all calls except the youngest and processes only the last value. The queue can grow again. The maximum value can be set selective via the config entry ctrlMaxPendings in the UI and CTRL Manager sections.
对于dpConnect函数,当注册的值发生变化时会触发相应的回调函数。如果出现上述信息,说明回调函数的触发速度大于实际处理速度(回调函数中代码的实际执行速度),导致队列排队,默认是200个长度的队列;如果队列不断增长并超过该长度,早期的触发将被丢弃,并且在日志中会显示上述消息。