Mercurial > hg > orthanc
diff OrthancServer/LuaScripting.cpp @ 2637:5094369664f0
Avoid unnecessary calls to the database if there is no Lua callback
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Mon, 28 May 2018 10:54:59 +0200 |
parents | 2e6b7862ccf2 |
children | 193ef9c1b731 |
line wrap: on
line diff
--- 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()))