This commit is contained in:
Alistair Smith
2025-05-30 18:55:03 -07:00
parent 693947673e
commit bed24f3a51
3 changed files with 5 additions and 5 deletions

View File

@@ -125,14 +125,14 @@ void ScriptExecutionContext::unrefEventLoop()
bool ScriptExecutionContext::canSendMessage()
{
us_loop_t* loop = (us_loop_t*)uws_get_loop();
uint32_t currentTickNr = static_cast<uint32_t>(us_loop_iteration_number(loop));
long long currentTickNr = static_cast<long long>(us_loop_iteration_number(loop));
if (lastSendTickNr != currentTickNr) {
messagesSentThisTick = 0;
lastSendTickNr = currentTickNr;
}
constexpr uint32_t MAX_MESSAGES_PER_TICK = 1000;
constexpr long long MAX_MESSAGES_PER_TICK = 1000;
if (messagesSentThisTick >= MAX_MESSAGES_PER_TICK) {
return false;
}

View File

@@ -60,7 +60,7 @@ public:
}
uint32_t messagesSentThisTick = 0;
uint32_t lastSendTickNr = -1; // Will be updated to the us_loop_t->data.iteration_nr every tick we send a message in
long long lastSendTickNr = -1; // Will be updated to the us_loop_t->data.iteration_nr every tick we send a message in
// https://github.com/oven-sh/bun/blob/d7a517cdfc31705a6b4fb696dc834ba8d98d5d3a/packages/bun-usockets/src/internal/loop_data.h#L58
bool canSendMessage();

View File

@@ -278,8 +278,8 @@ void MessagePort::processMessages(ScriptExecutionContext& context, Vector<Messag
dispatchEvent(event.event);
if (scope.exception()) [[unlikely]] {
globalObject->reportUncaughtExceptionAtEventLoop(globalObject, scope.exception());
scope.clearExceptionExceptTermination();
RELEASE_ASSERT(vm.hasPendingTerminationException());
return;
}
if (Zig::GlobalObject::scriptExecutionStatus(globalObject, globalObject) == ScriptExecutionStatus::Running) {