# HG changeset patch # User Sebastien Jodogne # Date 1527497887 -7200 # Node ID 25ae209dcea9f85fb722ce9bbf5c3e929c88866b # Parent c72eb844758cdde98017da146702bc994d3e6014 Avoid unnecessary calls to the database if there is no Lua callback diff -r c72eb844758c -r 25ae209dcea9 OrthancServer/LuaScripting.cpp --- a/OrthancServer/LuaScripting.cpp Mon May 28 10:52:18 2018 +0200 +++ b/OrthancServer/LuaScripting.cpp Mon May 28 10:58:07 2018 +0200 @@ -154,6 +154,16 @@ throw OrthancException(ErrorCode_InternalError); } + { + // Avoid unnecessary calls to the database if there's no Lua callback + LuaScripting::Lock lock(that); + + if (!lock.GetLua().IsExistingFunction(name)) + { + return; + } + } + Json::Value tags, metadata; if (that.context_.GetIndex().LookupResource(tags, change_.GetPublicId(), change_.GetResourceType()) && that.context_.GetIndex().GetMetadata(metadata, change_.GetPublicId()))