Asterobot runs every script within fixed limits, so that one script can't hold up Asterobot or the other bots. They're the same for every bot and every package, and a package can't change them. Here is each one, with its value and what happens past it.
Running code
| Limit | Value | Past the limit |
|---|---|---|
| Code running without a pause | 250 ms | The script stops, and the Problems alert shows a text containing JavaScript execution deadline exceeded. The game connection stays open. |
| Function calls nested in each other | 1024 | The script stops. A try/catch can't catch this. |
A pause is an await, or the end of the function Asterobot called. Each of these counts as one run, with its own 250 ms:
- the top level of the modules, when the script starts;
- the entry function, up to its first
await; - one call of a handler: from
on(),onTraffic(),intercept(),onChange(), a selector function, or an action'srun; - code resuming after an
await, together with any other code resuming at the same moment.
The text in the alert says which it was, for example Game traffic handler failed: JavaScript execution deadline exceeded for a handler, or drain JavaScript Promise jobs: JavaScript execution deadline exceeded for code that resumed after an await. The place in your code follows it.
Three cases don't stop the script:
- In an interceptor, the message goes on unchanged, and the bot's Console shows
interceptor failed: JavaScript execution deadline exceeded. - In an action's
run, the toast for the action says it failed, with the same text. - While Asterobot reads the package's declarations, reading fails. See Declarations.
Handlers, waits and sleeps
| Limit | Value | Past the limit |
|---|---|---|
Message handlers registered at once with on(), onTraffic() and intercept() together |
256 | The call throws a TypeError with maximum behavior handlers reached |
Handlers registered at once with onChange() |
256, counted apart from message handlers | The call throws a TypeError with maximum behavior handlers reached |
wait() calls not settled yet |
128 | The new wait() rejects with behavior resource limit exceeded: maximum waits reached |
sleep() calls not settled yet |
128 | The new sleep() rejects with behavior resource limit exceeded: maximum timers reached |
A handler removed with off() or offChange(), and a wait or a sleep that settled, frees its place. A wait() without a timeout that never matches keeps its place until the script stops.
Pending operations
| Limit | Value | Past the limit |
|---|---|---|
Operations waiting for their result: send(), request(), table(), find(), search() and query() together |
32 | The new call's promise rejects with behavior resource limit exceeded: maximum pending operations reached |
text() and record() answer right away and don't count. An operation frees its place as soon as its promise settles.
While all 32 places are taken, a click on one of the package's action buttons shows Couldn't start the action with behavior event-loop queue overflow. Settings applied at that moment are saved, but the running script only gets them at its next start.
Events waiting for the script
| Limit | Value | Past the limit |
|---|---|---|
| Events waiting to be handled | 64 | The script stops with behavior event-loop queue overflow |
The events are the messages that arrive, operations that finish, sleeps and wait timeouts that end, applied settings and clicked actions. A script handles them one at a time, so they pile up while its code is busy, for example in a handler that runs long or awaits nothing. A MITM bot relaying a busy game session receives many messages each second: keep handlers short.
A message waiting for an interceptor's decision is the exception. When the queue is full, it goes on unchanged instead of stopping the script.
On a MITM bot, Asterobot never slows the game down for what watches it. When the script or the Network tool can't keep up with the messages, Asterobot leaves some out of what they receive, and the game still gets them. A Full socket bot waits instead, and misses nothing.
Timeouts
| Limit | Value | Past the limit |
|---|---|---|
send() and request() |
30 seconds unless you pass { timeout } |
The promise rejects. For request(), with context deadline exceeded. |
wait() |
None unless you pass { timeout } |
With a timeout, the promise rejects with protocol wait timed out. Without one, it waits until the script stops. |
table(), find(), search() and query() |
30 seconds, fixed | The promise rejects |
| An interceptor's decision | 50 ms | The message goes on unchanged, and nothing is written anywhere |
Packages and modules
| Limit | Value | Past the limit |
|---|---|---|
| Modules the script loads, counting the built-in modules it imports | 256 | The script doesn't start: reachable module count exceeds limit 256 |
| Total size of those modules | 4 MiB (4,194,304 bytes) | The script doesn't start: reachable module source exceeds limit of 4194304 bytes |
Chain of imports, from index.js down |
64 modules | The script doesn't start: module graph depth <depth> exceeds limit 64 at "<module>" |
When a script doesn't start for one of these reasons, the toast after Play or Run doesn't say why. The bot's Settings tab does: Package settings shows Couldn't read this package's settings with the text.
Only the .js and .mjs files of a package are part of its code. A package archive you import is at most 32 MiB: see Zip files and the command line.
Game data
| Limit | Value | Past the limit |
|---|---|---|
Rows returned by one call of table(), find(), search() or query() |
200 by default, 5000 at most | A larger limit is lowered to 5000. query() sets truncated to true when rows were left out. |
Length of the SQL passed to query() |
65,536 bytes | The promise rejects with datacenter: query is <size> bytes, over the 65536 byte limit |
Time for one query(), waiting for its turn included |
10 seconds | The query is interrupted, and the promise rejects |
| Size of a single value a query builds | 16 MiB | The query fails |
| Queries running at once on one game version, across every bot and Asteroboard | 4 | The next query waits for its turn, and the wait counts toward its 10 seconds |
Consoles
| Limit | Value | Past the limit |
|---|---|---|
| Lines Asterobot keeps for each bot's Console | 200 | A Console tab opened later starts with the last 200 lines only |
| Interceptor failures written to the bot's Console for one message | The first, and the tenth | When several interceptors fail on the same message, the other failures aren't written. The count starts again with each message. |
Error messages explains every text on this page, and Async and timing shows how to write scripts that stay within the limits.
Aucun avis à afficher.