Skip to content

Commit

Permalink
fix: make sure to pick the correct script pool on acquire release and…
Browse files Browse the repository at this point in the history
… cleanup
  • Loading branch information
tglman committed Dec 22, 2022
1 parent 6fa3793 commit e8f32ff
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public OPolyglotScriptExecutor(final String language, OScriptTransformer scriptT
private Context resolveContext(ODatabaseDocumentInternal database) {
OResourcePool<ODatabaseDocumentInternal, Context> pool =
contextPools.computeIfAbsent(
language,
database.getName(),
(k) -> {
return new OResourcePool<ODatabaseDocumentInternal, Context>(
database.getConfiguration().getValueAsInteger(OGlobalConfiguration.SCRIPT_POOL),
Expand All @@ -51,8 +51,8 @@ private Context resolveContext(ODatabaseDocumentInternal database) {
return pool.getResource(database, 0);
}

private void returnContext(Context context) {
OResourcePool<ODatabaseDocumentInternal, Context> pool = contextPools.get(language);
private void returnContext(Context context, ODatabaseDocumentInternal database) {
OResourcePool<ODatabaseDocumentInternal, Context> pool = contextPools.get(database.getName());
if (pool != null) {
pool.returnResource(context);
}
Expand Down Expand Up @@ -139,7 +139,7 @@ public OResultSet execute(ODatabaseDocumentInternal database, String script, Map
new OCommandScriptException("Error on execution of the script", script, col),
new ScriptException(e));
} finally {
returnContext(ctx);
returnContext(ctx, database);
}
}

Expand Down Expand Up @@ -193,7 +193,7 @@ public Object executeFunction(
new OCommandScriptException("Error on execution of the script", functionName, col),
new ScriptException(e));
} finally {
returnContext(ctx);
returnContext(ctx, database);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -730,11 +730,6 @@ protected void resolveTracking(final ORecordOperation change) {
OClassIndexManager.processIndexOnUpdate(database, updateDoc, changes);
if (clazz.isFunction()) {
database.getSharedContext().getFunctionLibrary().updatedFunction(updateDoc);
database
.getSharedContext()
.getOrientDB()
.getScriptManager()
.close(database.getName());
}
if (clazz.isSequence()) {
((OSequenceLibraryProxy) database.getMetadata().getSequenceLibrary())
Expand Down

0 comments on commit e8f32ff

Please sign in to comment.