Description
Figure out some way to make it so that, if the client SDK receives e.g. 1000 messages in a single frame, we spread them out over the subsequent few frames, rather than blocking the main thread and dropping the frame rate. One possible way to implement this would be to give each call to FrameTick
a TimeSpan budget
, and then to break out of the loop if the total time spent processing during this call exceeds the budget
. (This will not be a guarantee that any given call to FrameTick
takes strictly less time than budget
, but a best-effort to not exceed it by more than one full message.) The regular FrameTick
method can probably have a hard-coded budget of, say, 10 ms (some number that's less than 1/60 of a second), but we should also provide an override that just takes the budget as an argument.