# HG changeset patch # User Sebastien Jodogne # Date 1527497699 -7200 # Node ID 5094369664f04b627241e38961910df0092d10e4 # Parent 442e7ef5cc41c7bf09261dc4869808656a7625b5 Avoid unnecessary calls to the database if there is no Lua callback diff -r 442e7ef5cc41 -r 5094369664f0 OrthancServer/LuaScripting.cpp --- a/OrthancServer/LuaScripting.cpp Fri May 25 18:54:11 2018 +0200 +++ b/OrthancServer/LuaScripting.cpp Mon May 28 10:54:59 2018 +0200 @@ -468,7 +468,15 @@ throw OrthancException(ErrorCode_InternalError); } - + { + // Avoid unnecessary calls to the database if there's no Lua callback + boost::recursive_mutex::scoped_lock lock(mutex_); + if (!lua_.IsExistingFunction(name)) + { + return; + } + } + Json::Value tags, metadata; if (context_.GetIndex().LookupResource(tags, change.GetPublicId(), change.GetResourceType()) && context_.GetIndex().GetMetadata(metadata, change.GetPublicId()))