Skip to content

Commit

Permalink
shared: Disable CallFunctionWithTimeout for now
Browse files Browse the repository at this point in the history
Former-commit-id: 7aa6fd0
  • Loading branch information
LeonMrBonnie committed Dec 29, 2021
1 parent 0e33f78 commit 717654d
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions shared/V8Helpers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,21 +372,21 @@ alt::String V8Helpers::GetJSValueTypeName(v8::Local<v8::Value> val)
v8::MaybeLocal<v8::Value> V8Helpers::CallFunctionWithTimeout(v8::Local<v8::Function> fn, v8::Local<v8::Context> ctx, std::vector<v8::Local<v8::Value>>& args, uint32_t timeout)
{
v8::Isolate* isolate = ctx->GetIsolate();
std::shared_ptr<bool> hasTimedOut{ new bool(false) };
/*std::shared_ptr<bool> hasTimedOut{ new bool(false) };
std::shared_ptr<bool> hasFinished{ new bool(false) };
std::thread([=]() {
std::this_thread::sleep_for(std::chrono::milliseconds(timeout));
if(*hasFinished || isolate->IsExecutionTerminating()) return;
*hasTimedOut = true;
isolate->TerminateExecution();
}).detach();
}).detach();*/

v8::MaybeLocal<v8::Value> result = fn->Call(ctx, v8::Undefined(isolate), args.size(), args.data());
*hasFinished = true;
/**hasFinished = true;
if(*hasTimedOut)
{
Log::Error << "[V8] Script execution timed out" << Log::Endl;
return v8::MaybeLocal<v8::Value>();
}
}*/
return result;
}

0 comments on commit 717654d

Please sign in to comment.