Skip to content

Commit 16f97aa

Browse files
committed
Add missing thread pool initialization to libsql callbacks
1 parent a7a074d commit 16f97aa

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

cpp/DBHostObject.cpp

+4-2
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ DBHostObject::DBHostObject(jsi::Runtime &rt, std::string &url,
144144
std::string &auth_token,
145145
std::shared_ptr<react::CallInvoker> invoker)
146146
: db_name(url), invoker(std::move(invoker)), rt(rt) {
147+
_thread_pool = std::make_shared<ThreadPool>();
147148
db = opsqlite_libsql_open_remote(url, auth_token);
148149

149150
create_jsi_functions();
@@ -155,6 +156,7 @@ DBHostObject::DBHostObject(jsi::Runtime &rt,
155156
std::string &url, std::string &auth_token,
156157
int sync_interval)
157158
: db_name(db_name), invoker(std::move(invoker)), rt(rt) {
159+
_thread_pool = std::make_shared<ThreadPool>();
158160
db = opsqlite_libsql_open_sync(db_name, path, url, auth_token,
159161
sync_interval);
160162

@@ -371,7 +373,7 @@ void DBHostObject::create_jsi_functions() {
371373
: std::vector<JSVariant>();
372374

373375
auto promiseCtr = rt.global().getPropertyAsFunction(rt, "Promise");
374-
auto promise = promiseCtr.callAsConstructor(rt,
376+
auto promise = promiseCtr.callAsConstructor(rt,
375377
HOSTFN("executor") {
376378
auto task = [this, &rt, query, params,
377379
resolve = std::make_shared<jsi::Value>(rt, args[0]),
@@ -425,7 +427,7 @@ void DBHostObject::create_jsi_functions() {
425427
return {};
426428
}));
427429

428-
return promise;
430+
return promise;
429431
});
430432

431433
function_map["executeWithHostObjects"] = HOSTFN("executeWithHostObjects") {

0 commit comments

Comments
 (0)