Skip to content

Commit

Permalink
rotor: increase isolate-vm pool
Browse files Browse the repository at this point in the history
  • Loading branch information
absorbb committed Dec 15, 2023
1 parent 834739c commit 48bcee3
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
2 changes: 1 addition & 1 deletion libs/core-functions/src/functions/lib/mongodb.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ async function createClient() {
log.atInfo().log(`Connecting to MongoDB server...`);

// Create a new MongoClient
const client = new MongoClient(mongodbURL);
const client = new MongoClient(mongodbURL, { readPreference: "nearest" });
// Connect the client to the server (optional starting in v4.7)
await client.connect();
// Establish and verify connection
Expand Down
34 changes: 23 additions & 11 deletions libs/core-functions/src/functions/lib/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,29 +87,41 @@ export const createMongoStore = (namespace: string, mongo: MongoClient, defaultT

return {
get: async (key: string) => {
const res = await mongo.db(dbName).collection<StoreValue>(namespace).findOne({ _id: key });
const res = await mongo
.db(dbName)
.collection<StoreValue>(namespace)
.findOne({ _id: key }, { readPreference: "nearest" });
return res ? res.value : undefined;
},
set: async (key: string, obj: any, opts?: SetOpts) => {
await ensureCollection();
const ttl = getTtlSec(opts);
const expireAt = new Date();
expireAt.setSeconds(expireAt.getSeconds() + ttl);
await mongo.db(dbName).collection<StoreValue>(namespace).replaceOne(
{ _id: key },
{
value: obj,
expireAt,
},
{ upsert: true }
);
await mongo
.db(dbName)
.collection<StoreValue>(namespace)
.replaceOne(
{ _id: key },
{
value: obj,
expireAt,
},
{ upsert: true, writeConcern: { w: 1, journal: false } }
);
},
del: async (key: string) => {
await ensureCollection();
await mongo.db(dbName).collection<StoreValue>(namespace).deleteOne({ _id: key });
await mongo
.db(dbName)
.collection<StoreValue>(namespace)
.deleteOne({ _id: key }, { writeConcern: { w: 1, journal: false } });
},
ttl: async (key: string) => {
const res = await mongo.db(dbName).collection<StoreValue>(namespace).findOne({ _id: key });
const res = await mongo
.db(dbName)
.collection<StoreValue>(namespace)
.findOne({ _id: key }, { readPreference: "nearest" });
return res ? Math.max(Math.floor((res.expireAt.getTime() - new Date().getTime()) / 1000), 0) : -2;
},
};
Expand Down
2 changes: 1 addition & 1 deletion libs/core-functions/src/functions/udf_wrapper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const UDFWrapper = (functionId, name, functionCode: string): UDFWrapperRe
let isolate: Isolate;
try {
//const wrappedCode = `let exports = {}\n${functionCode}\n${wrapperJs}`;
isolate = new Isolate({ memoryLimit: 10 });
isolate = new Isolate({ memoryLimit: 128 });
const context = isolate.createContextSync();
const jail = context.global;

Expand Down

1 comment on commit 48bcee3

@vercel
Copy link

@vercel vercel bot commented on 48bcee3 Dec 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

new-jitsu – ./webapps/console

ag.ru
logu.au
ozon.ru
sse.ere
erxes.io
baidu.dom
sambla.se
bobsec.com
sambla.com
agro4u.life
bluetick.ai
protontv.eu
t.quenti.io
alicesec.com
dev.aclis.io
docs.dh19.de
docs.dh19.eu
joseviso.com
mydomain.dom
t.democo.dev
t.shoppub.io
t2.jitsu.com
timeplus.com
zoopsign.com
*.d.jitsu.com
beta.mitzu.io
d.versatus.io
data.light.so
data.loudy.co
data.schej.it
dog.jitsu.com
imusician.app
imusician.pro
jitsu.logu.au
jitsu.www1.ru
t.thequack.ai
thinkr.com.br
use.jitsu.com
usepolygon.io
www.sambla.se
ajewellers.com
data.uselog.io
gpt.whatfa.com
sidetrekai.com
t.papermark.io
t.saasmonk.app
use2.jitsu.com
www.kellen.top
*.dataspecc.com
app.bluetick.ai
caddy.jitsu.com
events.mitzu.io
dev.blazingboost.com
j.israeladvocate.org
mercury.stagehub.com
store.sidetrekai.com
teslahenry.github.io
data.hogarlylabs.tech
data.your-company.com
event.clickncruise.hu
event.clickncruise.ro
test-domain.jitsu.com
test.bigfootproof.com
teste.fazcomex.com.br
analytics.dev.knekt.io
loraboutiquedental.com
notion.twelftree.co.uk
dev-portal.zoopsign.com
event.tradejobsnz.co.nz
investing-poc.jitsu.dev
savvy-replay.jitsu.tech
data.analytics-smart.com
data.handelsregister.app
event.clickncruise.co.uk
jt.fairhopeweb.github.io
savvy-replay2.jitsu.tech
savvy-replay3.jitsu.tech
savvy-replay4.jitsu.tech
track.alquimiaweb.com.br
track.pressance-group.jp
track.uniquecafes.com.br
colectha.agenciavoolu.com
kolectha.agenciavoolu.com
lp.loraboutiquedental.com
stage-portal.zoopsign.com
new-jitsu-jitsu.vercel.app
lodercom-colectha.voolu.shop
warehouse1.trendstyle.com.au
d0.livingdesignsfurniture.com
ingest-load-testing.jitsu.dev
jitsu.precisaosistemas.com.br
analytics.inspiresolutions.app
betteruptime-monitoring.jitsu.dev
canvas.livingdesignsfurniture.com
analytics.dev.inspiresolutions.app
cl9vt45z50001znkunc6v8fmm.d.jitsu.com
clm2jikrm00002v6r5l6niws3.d.jitsu.com
new-jitsu-git-newjitsu-jitsu.vercel.app
3000-rajaraodv-customerdemo-nmpsqwflswt.ws-us102.gitpod.io
new.jitsu.dev

Please sign in to comment.