Flow Control
What is Flow Control?
Flow Control is a mechanism implemented to prevent the excessive use of APIs. It operates based on the overall frequency and the nature of API calls made within a single space.
If you use the APIs subject to Flow Control at a high frequency, Flow Control Delay will occur. When Flow Control Delay occurs, it increases the time between the API call and when its effects take place.
APIs Subject to Flow Control
In the current implementation, Flow Control is applied to APIs for Modifying the State of Other Items and Players. Refer to the script reference for details on which APIs are subject to Flow Control.
Conditions under which Flow Control Delay occurs
As a guideline, Flow Control Delay occurs if the usage frequency of the target APIs exceeds 80 calls per second within a single space. You can confirm whether Flow Control Delay is occurring by checking the console logs.
When “Show all logs” is enabled in the Developer Menu, the console displays warnings about Flow Control Delay, like the following:
ClusterMessageDelayWarning: a delay of 0.6 seconds has occurred (maximum delay limit: 30 seconds)
In the above example, a Flow Control Delay of 0.6 seconds has occurred.
Countermeasures for Flow Control Delay
Even if Flow Control Delay occurs, the Cluster app can continue running. However, user experience is likely to deteriorate.
If Flow Control Delay is observed in your world, consider the following countermeasures:
- Reduce the frequency of the APIs causing the delay
- Reduce the size of data in messages sent in APIs such as
send
orsendTo
For more detailed control methods, please also refer to Details of Flow Control.
Errors that occur when Flow Control Delay becomes excessive
The following APIs will throw an error if Flow Control Delay exceeds 30 seconds:
ItemHandle.send
PlayerHandle.send
PlayerScript.sendTo